Mercurial > sdl-ios-xcode
diff src/SDL_compat.c @ 5170:88c656ffea44
Fixed crash if SDL_VideoDriverName() is passed a NULL namebuf
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 03 Feb 2011 16:57:38 -0800 |
parents | df758fce08e9 |
children | ededa1ccf91c |
line wrap: on
line diff
--- a/src/SDL_compat.c Thu Feb 03 15:49:37 2011 -0800 +++ b/src/SDL_compat.c Thu Feb 03 16:57:38 2011 -0800 @@ -57,8 +57,12 @@ { const char *name = SDL_GetCurrentVideoDriver(); if (name) { - SDL_strlcpy(namebuf, name, maxlen); - return namebuf; + if (namebuf) { + SDL_strlcpy(namebuf, name, maxlen); + return namebuf; + } else { + return name; + } } return NULL; }