src/SDL_error.c
changeset 1172 f69f4d25fb20
parent 769 b8d311d90021
child 1312 c9b51268668f
     1.1 --- a/src/SDL_error.c	Thu Nov 17 02:35:15 2005 +0000
     1.2 +++ b/src/SDL_error.c	Thu Nov 17 03:04:47 2005 +0000
     1.3 @@ -108,8 +108,10 @@
     1.4  			    case 's':
     1.5  				{
     1.6  				  int index = error->argc;
     1.7 -				  strncpy((char *)error->args[index].buf,
     1.8 -					va_arg(ap, char *), ERR_MAX_STRLEN);
     1.9 +				  char *str = va_arg(ap, char *);
    1.10 +				  if (str == NULL)
    1.11 +				      str = "(null)";
    1.12 +				  strncpy((char *)error->args[index].buf, str, ERR_MAX_STRLEN);
    1.13  				  error->args[index].buf[ERR_MAX_STRLEN-1] = 0;
    1.14  				  error->argc++;
    1.15  				}