Mercurial > sdl-ios-xcode
changeset 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 | 4d39eeaad00b |
children | db487f28419e |
files | src/SDL_compat.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
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; }