Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed crash if SDL_VideoDriverName() is passed a NULL namebuf
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 4, 2011
1 parent 6cde0d2 commit 8c576bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/SDL_compat.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8c576bf

Please sign in to comment.