From 59488131692157b607ec15df726418ac49fbbfca Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 9 Feb 2017 13:02:12 -0600 Subject: 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. --- engines/sci/engine/kfile.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'engines') 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; -- cgit v1.2.3