Mapster32: fix a crash when m32_settings.cfg contains video setting.

Such as "vid_gamma". In that case, setbrightness() would have been
called without basepaltableptr having been initialized.
The fix is by moving the preparational setbasepaltable() call from
ExtPostStartupWindow() to ExtInit(), just before the OSD command
dispatching.

git-svn-id: https://svn.eduke32.com/eduke32@4573 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-08-16 18:32:49 +00:00
parent 63916ee8d1
commit 9969efd8d1

View file

@ -9807,6 +9807,11 @@ int32_t ExtInit(void)
Bsprintf(apptitle, "Mapster32 %s %s", VERSION, s_buildRev);
autosavetimer = totalclock+120*autosave;
// This must run before the following OSD_Exec() as the cfg may
// e.g. contain a vid_gamma setting, resulting in a crash in
// setbrightness() which expects basepaltableptr to be initialized.
setbasepaltable(basepaltable, BASEPALCOUNT);
registerosdcommands();
{
@ -9842,8 +9847,6 @@ int32_t ExtPostStartupWindow(void)
return -1;
}
setbasepaltable(basepaltable, BASEPALCOUNT);
if (ReadPaletteTable())
return -1;