aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-09-21 21:50:45 +0200
committerEugene Sandulenko2016-09-21 21:59:35 +0200
commitadb2ef6df704b6a57290e52b39ea2392bf9f4aec (patch)
tree5a599b450a72c8f2f4341f984566be7c1fa2d7fb
parentdd4f58e9d4042a98dc9ad1263f3c571714e86f36 (diff)
downloadscummvm-rg350-adb2ef6df704b6a57290e52b39ea2392bf9f4aec.tar.gz
scummvm-rg350-adb2ef6df704b6a57290e52b39ea2392bf9f4aec.tar.bz2
scummvm-rg350-adb2ef6df704b6a57290e52b39ea2392bf9f4aec.zip
FULLPIPE: Fix crash when savepath is not writeable
-rw-r--r--engines/fullpipe/statesaver.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/engines/fullpipe/statesaver.cpp b/engines/fullpipe/statesaver.cpp
index eb5de08422..c6f4851a44 100644
--- a/engines/fullpipe/statesaver.cpp
+++ b/engines/fullpipe/statesaver.cpp
@@ -105,6 +105,11 @@ void GameLoader::writeSavegame(Scene *sc, const char *fname) {
// Now dump it into save file
Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(fname);
+ if (!saveFile) {
+ warning("Cannot open file for writing: %s", fname);
+ return;
+ }
+
saveFile->writeUint32LE(header.version);
saveFile->write(header.magic, 32);
saveFile->writeUint32LE(header.updateCounter);