Skip to content
Snippets Groups Projects
Commit 83c4dba4 authored by Monster Iestyn's avatar Monster Iestyn
Browse files

Fix crash reported by FuriousFox at http://mb.srb2.org/showthread.php?t=41536

Basically this makes sure numwadfiles is updated before loading the SOC/Lua scripts, so if a Lua script calls COM_BufInsertText with the contents "addfile scr_mysticrealm.wad" it can't overwrite the last written wadfile slot! Not that COM_BufInsertText really should be used like that to begin with
parent 919e3ed0
Branches
Tags
No related merge requests found
...@@ -475,11 +475,11 @@ UINT16 W_LoadWadFile(const char *filename) ...@@ -475,11 +475,11 @@ UINT16 W_LoadWadFile(const char *filename)
// //
CONS_Printf(M_GetText("Added file %s (%u lumps)\n"), filename, numlumps); CONS_Printf(M_GetText("Added file %s (%u lumps)\n"), filename, numlumps);
wadfiles[numwadfiles] = wadfile; wadfiles[numwadfiles] = wadfile;
W_LoadDehackedLumps(numwadfiles); numwadfiles++; // must come BEFORE W_LoadDehackedLumps, so any addfile called by COM_BufInsertText called by Lua doesn't overwrite what we just loaded
W_LoadDehackedLumps(numwadfiles-1);
W_InvalidateLumpnumCache(); W_InvalidateLumpnumCache();
numwadfiles++;
return wadfile->numlumps; return wadfile->numlumps;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment