aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2017-02-09 13:02:12 -0600
committerColin Snover2017-04-23 13:07:25 -0500
commit59488131692157b607ec15df726418ac49fbbfca (patch)
tree144ab4ae2215a3c6341b7f4b4f8625e418b72c59 /engines
parenta867fb70ddc145b03b8b782401364681e8c5560c (diff)
downloadscummvm-rg350-59488131692157b607ec15df726418ac49fbbfca.tar.gz
scummvm-rg350-59488131692157b607ec15df726418ac49fbbfca.tar.bz2
scummvm-rg350-59488131692157b607ec15df726418ac49fbbfca.zip
SCI32: Fix crash when writing word to VIRTUALFILE_HANDLE_SCI32SAVE
This happens in Phant2 when trying to delete a save game from the in-game save dialogue.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kfile.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 6f77b0a390..732d61f809 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -851,7 +851,15 @@ reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv) {
}
reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv) {
- FileHandle *f = getFileFromHandle(s, argv[0].toUint16());
+ uint16 handle = argv[0].toUint16();
+
+#ifdef ENABLE_SCI32
+ if (handle == VIRTUALFILE_HANDLE_SCI32SAVE) {
+ return s->r_acc;
+ }
+#endif
+
+ FileHandle *f = getFileFromHandle(s, handle);
if (f)
f->_out->writeUint16LE(argv[1].toUint16());
return s->r_acc;