Skip to content

Commit

Permalink
SCI: Fix disassembler crash on invalid property
Browse files Browse the repository at this point in the history
Fixes debugger crash when disassembling an instruction whose operand
is an invalid property. This occurs in LB2 floppy 1.0 script 720 in
sGetUp:changeState and sStepOnNail:changeState.
  • Loading branch information
sluicebox authored and bluegr committed Mar 18, 2019
1 parent cea00af commit f73584f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion engines/sci/engine/scriptdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ reg_t disassemble(EngineState *s, reg_t pos, const Object *obj, bool printBWTag,
if (obj != nullptr) {
const Object *const super = obj->getClass(s->_segMan);
assert(super);
selectorName = kernel->getSelectorName(super->getVarSelector(param_value / 2)).c_str();
if (param_value / 2 < super->getVarCount()) {
selectorName = kernel->getSelectorName(super->getVarSelector(param_value / 2)).c_str();
} else {
selectorName = "<invalid>";
}
} else {
selectorName = "<unavailable>";
}
Expand Down

0 comments on commit f73584f

Please sign in to comment.