Browse Source

Fixed crash with SDL_SetError(NULL)

Sam Lantinga 11 years ago
parent
commit
40538446d9
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/stdlib/SDL_string.c

+ 3 - 0
src/stdlib/SDL_string.c

@@ -1468,6 +1468,9 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt,
     size_t left = maxlen;
     size_t left = maxlen;
     char *textstart = text;
     char *textstart = text;
 
 
+    if (!fmt) {
+        fmt = "";
+    }
     while (*fmt) {
     while (*fmt) {
         if (*fmt == '%') {
         if (*fmt == '%') {
             SDL_bool done = SDL_FALSE;
             SDL_bool done = SDL_FALSE;