From 3bd6c99a3bfac31af91a9ad9f36a8f38d3f75014 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 17 Jul 2024 11:12:58 +0200 Subject: [PATCH] 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 --- src/w_wad.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/w_wad.c b/src/w_wad.c index 07df9eb02..f051403bd 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -2161,8 +2161,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);