Cheap fix for load game menu crash

git-svn-id: https://svn.eduke32.com/eduke32@6957 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-07-26 16:34:03 +00:00
parent c5054af778
commit ddd8b7e5bb

View file

@ -205,7 +205,10 @@ static void ReadSaveGameHeaders_Internal(void)
// potentially overallocating but programmatically simple // potentially overallocating but programmatically simple
size_t const numfiles = countcache1dfind(findfiles_default); size_t const numfiles = countcache1dfind(findfiles_default);
size_t const internalsavesize = sizeof(menusave_t) * numfiles; size_t const internalsavesize = sizeof(menusave_t) * numfiles;
g_internalsaves = (menusave_t *)Xrealloc(g_internalsaves, internalsavesize); g_internalsaves = (menusave_t *)Xrealloc(g_internalsaves, internalsavesize);
if (internalsavesize)
g_internalsaves->clear(); g_internalsaves->clear();
g_numinternalsaves = 0; g_numinternalsaves = 0;
@ -222,8 +225,12 @@ static void ReadSaveGameHeaders_Internal(void)
} }
} }
size_t const menusavesize = sizeof(menusave_t) * g_nummenusaves; size_t const menusavesize = sizeof(menusave_t) * g_nummenusaves;
g_menusaves = (menusave_t *)Xrealloc(g_menusaves, menusavesize); g_menusaves = (menusave_t *)Xrealloc(g_menusaves, menusavesize);
if (menusavesize)
g_menusaves->clear(); g_menusaves->clear();
for (size_t x = g_numinternalsaves-1, y = 0; x < g_numinternalsaves; --x) for (size_t x = g_numinternalsaves-1, y = 0; x < g_numinternalsaves; --x)
{ {
menusave_t & msv = g_internalsaves[x]; menusave_t & msv = g_internalsaves[x];