diff options
-rw-r--r-- | src/map/script.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/map/script.c b/src/map/script.c index 235b7b8d5..39f8a7b63 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -3387,15 +3387,13 @@ void script_free_code(struct script_code* code) { nullpo_retv(code); - if( code->instances ) + if (code->instances) script->stop_instances(code); - else { - script->free_vars(code->local.vars); - if( code->local.arrays ) - code->local.arrays->destroy(code->local.arrays,script->array_free_db); - } - aFree( code->script_buf ); - aFree( code ); + script->free_vars(code->local.vars); + if (code->local.arrays) + code->local.arrays->destroy(code->local.arrays,script->array_free_db); + aFree(code->script_buf); + aFree(code); } /// Creates a new script state. |