be null string pointer safe

SVN revision: 7009
This commit is contained in:
Carsten Haitzler 2003-06-11 09:09:17 +00:00
parent 47c156847f
commit 4cb41d0dd2
1 changed files with 2 additions and 1 deletions

View File

@ -959,9 +959,10 @@ eet_data_put_string(void *src, int *size_ret)
{
char *s, *d;
int len;
const char *empty_s = "";
if (!src) src = "";
s = (char *)(*((char **)src));
if (!s) s = (char *)empty_s;
len = strlen(s);
d = malloc(len + 1);
if (!d) return NULL;