Fixed crash if SDL_VideoDriverName() is passed a NULL namebuf
This commit is contained in:
parent
052351dbe2
commit
4f0e222a0b
1 changed files with 6 additions and 2 deletions
|
@ -57,8 +57,12 @@ SDL_VideoDriverName(char *namebuf, int maxlen)
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue