summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorDastgir <dastgirp@gmail.com>2017-06-13 12:46:20 +0530
committerDastgir <dastgirp@gmail.com>2017-06-13 12:46:20 +0530
commit8ad26d759d290ddc714ed66a80f012adffe9a485 (patch)
tree5baf29e467c787d338b043cd67adfd7831b89a41 /src/map/npc.c
parent2f2fe7faf7456edb7e39c2c887d1dc7d2ba3b577 (diff)
downloadhercules-8ad26d759d290ddc714ed66a80f012adffe9a485.tar.gz
hercules-8ad26d759d290ddc714ed66a80f012adffe9a485.tar.bz2
hercules-8ad26d759d290ddc714ed66a80f012adffe9a485.tar.xz
hercules-8ad26d759d290ddc714ed66a80f012adffe9a485.zip
Fixes crash when npcshopattach was called on sell shop.
Fixes #1772
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 2876ea595..a358fd2fb 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2119,6 +2119,17 @@ int npc_selllist_sub(struct map_session_data *sd, struct itemlist *item_list, st
script->cleararray_pc(sd, card_slot, (void*)0);
}
+ for (j = 0; j < MAX_ITEM_OPTIONS; j++) { // Clear Each item option entry
+ key_opt_idx[j] = 0;
+ key_opt_value[j] = 0;
+
+ snprintf(opt_index_str, sizeof(opt_index_str), "@slot_opt_idx%d", j + 1);
+ script->cleararray_pc(sd, opt_index_str, (void*)0);
+
+ snprintf(opt_value_str, sizeof(opt_value_str), "@slot_opt_val%d", j + 1);
+ script->cleararray_pc(sd, opt_value_str, (void*)0);
+ }
+
// save list of to be sold items
for (i = 0; i < VECTOR_LENGTH(*item_list); i++) {
struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, i);