mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
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
This commit is contained in:
parent
919e3ed0e2
commit
83c4dba4ce
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue