diff options
author | panikon <panikon@zoho.com> | 2014-04-19 23:00:08 -0300 |
---|---|---|
committer | panikon <panikon@zoho.com> | 2014-04-19 23:00:08 -0300 |
commit | 74b21f5e0db73e6e093fc4126d4f6cb15d701758 (patch) | |
tree | 4491b2b5a58e6903a252cbe9aa1e88a0f72c1a87 /src | |
parent | 32b33d8408b02ab2d133872de770446c32046fa3 (diff) | |
download | hercules-74b21f5e0db73e6e093fc4126d4f6cb15d701758.tar.gz hercules-74b21f5e0db73e6e093fc4126d4f6cb15d701758.tar.bz2 hercules-74b21f5e0db73e6e093fc4126d4f6cb15d701758.tar.xz hercules-74b21f5e0db73e6e093fc4126d4f6cb15d701758.zip |
Fixed issue: 8146
* http://hercules.ws/board/tracker/issue-8146-reloaditemdb-item-combo-db-crash/
Diffstat (limited to 'src')
-rw-r--r-- | src/map/itemdb.c | 6 | ||||
-rw-r--r-- | src/map/script.c | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index abe899412..76183d0ec 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -2077,9 +2077,10 @@ int itemdb_final_sub(DBKey key, DBData *data, va_list ap) void itemdb_clear(bool total) { int i; // clear the previous itemdb data - for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i ) + for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i ) { if( itemdb->array[i] ) itemdb->destroy_item_data(itemdb->array[i], 1); + } for( i = 0; i < itemdb->group_count; i++ ) { if( itemdb->groups[i].nameid ) @@ -2120,7 +2121,8 @@ void itemdb_clear(bool total) { itemdb->package_count = 0; for(i = 0; i < itemdb->combo_count; i++) { - script->free_code(itemdb->combos[i]->script); + if( itemdb->combos[i]->script ) // Check if script was loaded + script->free_code(itemdb->combos[i]->script); aFree(itemdb->combos[i]); } if( itemdb->combos ) diff --git a/src/map/script.c b/src/map/script.c index 8ac657f93..3e11a510e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -3217,6 +3217,8 @@ void script_free_vars(struct DBMap* var_storage) { void script_free_code(struct script_code* code) { + nullpo_retv(code); + if( code->instances ) script->stop_instances(code); else { |