From 779b8336b1227f010099f8faabe4d0c9b035832e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 16 May 2017 22:41:47 +0200 Subject: SCI: Let getClassAddress fail gracefully with SCRIPT_GET_DONT_LOAD This fixes a crash in the debugger when disassembling the class opcode with a class from a script that hasn't yet been loaded. --- engines/sci/engine/seg_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/sci/engine') diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index d13d94a957..a941dd38b4 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -1016,6 +1016,9 @@ reg_t SegManager::getClassAddress(int classnr, ScriptLoadType lock, uint16 calle getScriptSegment(the_class->script, lock); if (!the_class->reg.getSegment()) { + if (lock == SCRIPT_GET_DONT_LOAD) + return NULL_REG; + error("[VM] Trying to instantiate class %x by instantiating script 0x%x (%03d) failed", classnr, the_class->script, the_class->script); } } else -- cgit v1.2.3