diff options
author | Orgad Shaneh | 2019-07-06 23:19:42 +0300 |
---|---|---|
committer | Filippos Karapetis | 2019-07-07 14:16:46 +0300 |
commit | 35c2f9ade51451de8dc88477500b82cfe69f2a5f (patch) | |
tree | 463bfff12f9de58b3affcf9c0e66bb5d7230eacd | |
parent | d8cb826b1951e08d04fb3a790daf0e4a62db114c (diff) | |
download | scummvm-rg350-35c2f9ade51451de8dc88477500b82cfe69f2a5f.tar.gz scummvm-rg350-35c2f9ade51451de8dc88477500b82cfe69f2a5f.tar.bz2 scummvm-rg350-35c2f9ade51451de8dc88477500b82cfe69f2a5f.zip |
BACKENDS: Fix crash when save file is owned by another user
fopen() fails, but the null handle was passed on to OutSaveFile.
-rw-r--r-- | backends/saves/default/default-saves.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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. |