Fix undefined behavior: null pointer passed as argument which is declared to never be null

git-svn-id: https://svn.eduke32.com/eduke32@5868 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-09-16 21:55:39 +00:00
parent 388c3832cd
commit e99dbb858e
2 changed files with 3 additions and 2 deletions

View file

@ -3491,7 +3491,8 @@ int32_t loaddefinitionsfile(const char *fn)
DO_FREE_AND_NULL(faketilebuffer); DO_FREE_AND_NULL(faketilebuffer);
faketilebuffersiz = 0; faketilebuffersiz = 0;
qsort(usermaphacks, num_usermaphacks, sizeof(usermaphack_t), compare_usermaphacks); if (usermaphacks != NULL)
qsort(usermaphacks, num_usermaphacks, sizeof(usermaphack_t), compare_usermaphacks);
if (!script) return -1; if (!script) return -1;

View file

@ -1711,7 +1711,7 @@ static void G_LoadMapHack(char *outbuf, const char *filename)
append_ext_UNSAFE(outbuf, ".mhk"); append_ext_UNSAFE(outbuf, ".mhk");
if (G_TryMapHack(outbuf)) if (G_TryMapHack(outbuf) && usermaphacks != NULL)
{ {
usermaphack_t *pMapInfo = (usermaphack_t*)bsearch( usermaphack_t *pMapInfo = (usermaphack_t*)bsearch(
&g_loadedMapHack, usermaphacks, num_usermaphacks, sizeof(usermaphack_t), &g_loadedMapHack, usermaphacks, num_usermaphacks, sizeof(usermaphack_t),