vres_GetMap: Count resources in folders up until next 0-length lump

justs in case the order of stuff may be weird
fixes keepmapmusic crash on some maps
This commit is contained in:
Alug committed 2024-07-17 11:12:58 +02:00
1 parent 79a5d174a5
commit da64d3ccbf
1 file changed
+5 -1
+5 -1
View File
@@ -2158,8 +2158,12 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
// Count number of lumps until the end of resource OR up until next "MAPXX" lump.
lumpnum_t lumppos = lumpnum + 1;
for (i = LUMPNUM(lumppos); i < wadfiles[WADFILENUM(lumpnum)]->numlumps; i++, lumppos++, numlumps++)
if (memcmp(W_CheckNameForNum(lumppos), "MAP", 3) == 0)
{
if (memcmp(W_CheckNameForNum(lumppos), "MAP", 3) == 0 || W_LumpLength(lumppos) == 0)
{
break;
}
}
numlumps++;
vlumps = Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL);