mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-25 12:05:53 +00:00
DRASCULA: Fix random crash when loading pendulum scene savegame
When saving from the pendulum scene the curX and curY values are negative while the curWidth and curHeight values are unset. This causes random crashes as we may do an array out of bound access when enterRoom() is called at the end of the load.
This commit is contained in:
parent
a97f9d0ec6
commit
d4a747705f
@ -300,6 +300,16 @@ bool DrasculaEngine::loadGame(int slot) {
|
||||
if (!sscanf(currentData, "%d.ald", &roomNum)) {
|
||||
error("Bad save format");
|
||||
}
|
||||
|
||||
// When loading room 102 while being attached below the pendulum Some variables
|
||||
// are not correctly set and can cause random crashes when calling enterRoom below.
|
||||
// The crash occurs in moveCharacters() when accessing factor_red[curY + curHeight].
|
||||
if (roomNum == 102 && flags[1] == 2) {
|
||||
curX = 103;
|
||||
curY = 108;
|
||||
curWidth = curHeight = 0;
|
||||
}
|
||||
|
||||
enterRoom(roomNum);
|
||||
selectVerb(kVerbNone);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user