From 7830f936aa2e9ea3668edea3eba8896dbc194cde Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 10 Jan 2020 22:51:41 +0100 Subject: DIRECTOR: Fix crash when built-in is being redefined --- engines/director/lingo/lingo-codegen.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 9077e9d6ad..4d15f964b0 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -242,7 +242,12 @@ Symbol *Lingo::define(Common::String &name, int nargs, ScriptData *code) { // we don't want to be here. The getHandler call should have used the EntityId and the result // should have been unique! warning("Redefining handler '%s'", name.c_str()); - delete sym->u.defn; + + // Do not attempt to remove code from built-ins + if (sym->type == HANDLER) + delete sym->u.defn; + else + sym->type = HANDLER; } sym->u.defn = code; -- cgit v1.2.3