From 40538446d903c521ae23d41327b2cc6ce708bb06 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 7 Jun 2014 17:31:50 -0700 Subject: [PATCH] Fixed crash with SDL_SetError(NULL) --- src/stdlib/SDL_string.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index 733a2571a..dd0eab1d0 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;