Fixed bug in get_length_upper_bound where g_print-ing a NULL string would cause a segfault

This commit is contained in:
Elliot Lee 1998-01-01 22:48:18 +00:00
parent e2f5eb1c3e
commit f7443e0e85

View File

@ -322,6 +322,7 @@ get_length_upper_bound (gchar* fmt, va_list *args)
int short_int;
int long_int;
int done;
char *tmp;
while (*fmt)
{
@ -362,7 +363,11 @@ get_length_upper_bound (gchar* fmt, va_list *args)
/* I ignore 'q' and 'L', they're not portable anyway. */
case 's':
len += strlen (va_arg (*args, char *));
tmp = va_arg(*args, char *);
if(tmp)
len += strlen (tmp);
else
len += strlen ("(null)");
done = TRUE;
break;
case 'd':