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();
|
const char *name = SDL_GetCurrentVideoDriver();
|
||||||
if (name) {
|
if (name) {
|
||||||
|
if (namebuf) {
|
||||||
SDL_strlcpy(namebuf, name, maxlen);
|
SDL_strlcpy(namebuf, name, maxlen);
|
||||||
return namebuf;
|
return namebuf;
|
||||||
|
} else {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue