From 35c2f9ade51451de8dc88477500b82cfe69f2a5f Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sat, 6 Jul 2019 23:19:42 +0300 Subject: BACKENDS: Fix crash when save file is owned by another user fopen() fails, but the null handle was passed on to OutSaveFile. --- backends/saves/default/default-saves.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 8973101a5a..44fd48bb7e 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -169,6 +169,8 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String // Open the file for saving. Common::WriteStream *const sf = fileNode.createWriteStream(); + if (!sf) + return nullptr; Common::OutSaveFile *const result = new Common::OutSaveFile(compress ? Common::wrapCompressedWriteStream(sf) : sf); // Add file to cache now that it exists. -- cgit v1.2.3