diff options
author | Ľubomír Remák | 2018-09-06 20:38:33 +0200 |
---|---|---|
committer | Ľubomír Remák | 2018-09-06 20:38:33 +0200 |
commit | c239a18620a9ecbfc0a160647263aa59180112df (patch) | |
tree | 84df177916a89069bf6aec30a73f9c67c9a85d36 /engines/mutationofjb/mutationofjb.cpp | |
parent | c36fb36afba47f52c1f81f1df61eb31838134cd2 (diff) | |
download | scummvm-rg350-c239a18620a9ecbfc0a160647263aa59180112df.tar.gz scummvm-rg350-c239a18620a9ecbfc0a160647263aa59180112df.tar.bz2 scummvm-rg350-c239a18620a9ecbfc0a160647263aa59180112df.zip |
MUTATIONOFJB: Small fixes.
Handle errors in save/load code.
Fix typo in Game::colorFromString.
Diffstat (limited to 'engines/mutationofjb/mutationofjb.cpp')
-rw-r--r-- | engines/mutationofjb/mutationofjb.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/engines/mutationofjb/mutationofjb.cpp b/engines/mutationofjb/mutationofjb.cpp index 84ef9742f1..ed4608b330 100644 --- a/engines/mutationofjb/mutationofjb.cpp +++ b/engines/mutationofjb/mutationofjb.cpp @@ -141,6 +141,8 @@ bool MutationOfJBEngine::canLoadGameStateCurrently() { Common::Error MutationOfJBEngine::loadGameState(int slot) { const Common::String saveName = Common::String::format("%s.%03d", _targetName.c_str(), slot); Common::InSaveFile *const saveFile = g_system->getSavefileManager()->openForLoading(saveName); + if (!saveFile) + return Common::kReadingFailed; Common::Serializer sz(saveFile, nullptr); @@ -162,6 +164,8 @@ bool MutationOfJBEngine::canSaveGameStateCurrently() { Common::Error MutationOfJBEngine::saveGameState(int slot, const Common::String &desc) { const Common::String saveName = Common::String::format("%s.%03d", _targetName.c_str(), slot); Common::OutSaveFile *const saveFile = g_system->getSavefileManager()->openForSaving(saveName); + if (!saveFile) + return Common::kWritingFailed; Common::Serializer sz(nullptr, saveFile); @@ -295,7 +299,9 @@ Common::Error MutationOfJBEngine::run() { setupCursor(); if (ConfMan.hasKey("save_slot")) { - loadGameState(ConfMan.getInt("save_slot")); + const Common::Error err = loadGameState(ConfMan.getInt("save_slot")); + if (err.getCode() != Common::kNoError) + return err; } else { _game->changeScene(13, false); // Initial scene. } |