aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/saveload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tsage/saveload.cpp')
-rw-r--r--engines/tsage/saveload.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp
index c261d091dd..db52050b03 100644
--- a/engines/tsage/saveload.cpp
+++ b/engines/tsage/saveload.cpp
@@ -129,8 +129,12 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
_macroSaveFlag = true;
_saveSlot = slot;
- // Set up the serializer
+ // Try and create the save file
Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(g_vm->generateSaveName(slot));
+ if (!saveFile)
+ return Common::kCreatingFileFailed;
+
+ // Set up the serializer
Serializer serializer(NULL, saveFile);
serializer.setSaveVersion(TSAGE_SAVEGAME_VERSION);
@@ -177,6 +181,9 @@ Common::Error Saver::restore(int slot) {
// Set up the serializer
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(g_vm->generateSaveName(slot));
+ if (!saveFile)
+ return Common::kReadingFailed;
+
Serializer serializer(saveFile, NULL);
// Read in the savegame header