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:
Fabian Greffrath 2019-01-20 20:48:30 +01:00
parent c4b93eb794
commit 921666f704

View file

@ -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)