glob: let I_NextGlob() return NULL if (glob == NULL)
If a non-existent directory is passed over to I_StartGlob(), e.g. when moving config files between computers, it will return NULL. If this return value is then fed into I_NextGlob(), it will trigger a segmentation fault. Add a check to the latter if (glob == NULL) and let it return NULL itself in this case.
This commit is contained in:
parent
c4b93eb794
commit
921666f704
1 changed files with 5 additions and 0 deletions
|
|
@ -319,6 +319,11 @@ const char *I_NextGlob(glob_t *glob)
|
|||
{
|
||||
const char *result;
|
||||
|
||||
if (glob == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// In unsorted mode we just return the filenames as we read
|
||||
// them back from the system API.
|
||||
if ((glob->flags & GLOB_FLAG_SORTED) == 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue