From a51f45407659bba43254b466d20b6af2e8f17ffd Mon Sep 17 00:00:00 2001 From: Christopher Page Date: Thu, 31 Jul 2008 21:56:05 +0000 Subject: Added check for valid save slots, when loading savestates using -x svn-id: r33483 --- engines/sky/sky.cpp | 7 +++++-- engines/touche/touche.cpp | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index 92df584f6f..44347cf9a7 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -343,8 +343,11 @@ int SkyEngine::go() { _keyPressed.reset(); uint16 result = 0; - if (ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") >= 0) - result = _skyControl->quickXRestore(ConfMan.getInt("save_slot")); + if (ConfMan.hasKey("save_slot")) { + int saveSlot = ConfMan.getInt("save_slot"); + if (saveSlot >= 0 && saveSlot <= 999) + result = _skyControl->quickXRestore(ConfMan.getInt("save_slot")); + } if (result != GAME_RESTORED) { bool introSkipped = false; diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp index a4a9b7df92..a7a362f2b1 100644 --- a/engines/touche/touche.cpp +++ b/engines/touche/touche.cpp @@ -252,10 +252,13 @@ void ToucheEngine::mainLoop() { _inp_rightMouseButtonPressed = false; if (ConfMan.hasKey("save_slot")) { - loadGameState(ConfMan.getInt("save_slot")); - _newEpisodeNum = 0; - resetSortedKeyCharsTable(); - showCursor(true); + int saveSlot = ConfMan.getInt("save_slot"); + if (saveSlot >= 0 && saveSlot <= 99) { + loadGameState(saveSlot); + _newEpisodeNum = 0; + resetSortedKeyCharsTable(); + showCursor(true); + } } else { _newEpisodeNum = ConfMan.getInt("boot_param"); if (_newEpisodeNum == 0) { -- cgit v1.2.3