diff options
author | Eugene Sandulenko | 2020-01-10 22:51:41 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2020-01-10 22:51:41 +0100 |
commit | 7830f936aa2e9ea3668edea3eba8896dbc194cde (patch) | |
tree | fe2fed1cd87849c4a64b1901357a99f833c14c05 | |
parent | f7a848e65de384b02057b9f4b849b041667ce30d (diff) | |
download | scummvm-rg350-7830f936aa2e9ea3668edea3eba8896dbc194cde.tar.gz scummvm-rg350-7830f936aa2e9ea3668edea3eba8896dbc194cde.tar.bz2 scummvm-rg350-7830f936aa2e9ea3668edea3eba8896dbc194cde.zip |
DIRECTOR: Fix crash when built-in is being redefined
-rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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; |