From adb2ef6df704b6a57290e52b39ea2392bf9f4aec Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 21 Sep 2016 21:50:45 +0200 Subject: FULLPIPE: Fix crash when savepath is not writeable --- engines/fullpipe/statesaver.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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); -- cgit v1.2.3