- fixed two crash bugs I found while testing some mods.

This commit is contained in:
Christoph Oelckers 2020-02-09 22:32:13 +01:00
parent 4e58265d21
commit e3f8fca36e
1 changed files with 7 additions and 2 deletions

View File

@ -3643,7 +3643,7 @@ badindex:
auto bindings = Bindings.GetKeysForCommand(C_CON_GetButtonFunc(gameFunc));
if ((unsigned)funcPos >= bindings.Size()) funcPos = 0;
quoteMgr.InitializeQuote(quoteIndex, KB_ScanCodeToString(bindings[funcPos]));
quoteMgr.InitializeQuote(quoteIndex, funcPos >= bindings.Size()? "???" : KB_ScanCodeToString(bindings[funcPos]));
dispatch();
}
@ -4281,13 +4281,18 @@ badindex:
} v;
Gv_FillWithVars(v);
int32_t const z = (VM_DECODE_INST(tw) == CON_GAMETEXTZ) ? Gv_GetVar(*insptr++) : 65536;
int32_t z = (VM_DECODE_INST(tw) == CON_GAMETEXTZ) ? Gv_GetVar(*insptr++) : 65536;
if (EDUKE32_PREDICT_FALSE(v.tilenum < 0 || v.tilenum + 127 >= MAXTILES))
{
CON_ERRPRINTF("invalid base tilenum %d\n", v.tilenum);
abort_after_error();
}
if (z <= 0)
{
CON_ERRPRINTF("Bad text size (<= 0)");
z = 65536;
}
VM_ASSERT((unsigned)v.nQuote < MAXQUOTES, "invalid quote %d\n", v.nQuote);