Commit 40538446d903c521ae23d41327b2cc6ce708bb06

Sam Lantinga 2014-06-07T17:31:50

Fixed crash with SDL_SetError(NULL)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c
index 733a257..dd0eab1 100644
--- a/src/stdlib/SDL_string.c
+++ b/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;
     char *textstart = text;
 
+    if (!fmt) {
+        fmt = "";
+    }
     while (*fmt) {
         if (*fmt == '%') {
             SDL_bool done = SDL_FALSE;