SCUMM: Fix array overflow writing var when no current script is set
This situation is triggered normally when _currentScript is 0xFF, but it could potentially also happen if _currentScript is some other number >= NUM_SCRIPT_SLOT, so the check is a bit more conservative than it might appear to need to be.
This commit is contained in:
parent
2b5605362a
commit
4d3f05ae79
1 changed files with 1 additions and 1 deletions
|
@ -651,7 +651,7 @@ void ScummEngine::writeVar(uint var, int value) {
|
|||
|
||||
_scummVars[var] = value;
|
||||
|
||||
if ((_varwatch == (int)var) || (_varwatch == 0)) {
|
||||
if ((_varwatch == (int)var || _varwatch == 0) && _currentScript < NUM_SCRIPT_SLOT) {
|
||||
if (vm.slot[_currentScript].number < 100)
|
||||
debug(1, "vars[%d] = %d (via script-%d)", var, value, vm.slot[_currentScript].number);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue