Commit 4f0e222a authored by Sam Lantinga's avatar Sam Lantinga

Fixed crash if SDL_VideoDriverName() is passed a NULL namebuf

parent 052351db
...@@ -57,8 +57,12 @@ SDL_VideoDriverName(char *namebuf, int maxlen) ...@@ -57,8 +57,12 @@ SDL_VideoDriverName(char *namebuf, int maxlen)
{ {
const char *name = SDL_GetCurrentVideoDriver(); const char *name = SDL_GetCurrentVideoDriver();
if (name) { if (name) {
SDL_strlcpy(namebuf, name, maxlen); if (namebuf) {
return namebuf; SDL_strlcpy(namebuf, name, maxlen);
return namebuf;
} else {
return name;
}
} }
return NULL; return NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment