summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2020-06-01 04:01:16 +0200
committerGitHub <noreply@github.com>2020-06-01 04:01:16 +0200
commitb9f7d1439c84b64facaf7d2875adc29110c65cf4 (patch)
tree808162f3083ac05b3221c7ffcdb4e52ffd4fb90a /src/map/script.c
parent6188b2eb25c9fdcd33cfbef50e3dd41774f37994 (diff)
parent410e04c2562f7d7dd9a2f242d6ef821dbe0b2fc5 (diff)
downloadhercules-b9f7d1439c84b64facaf7d2875adc29110c65cf4.tar.gz
hercules-b9f7d1439c84b64facaf7d2875adc29110c65cf4.tar.bz2
hercules-b9f7d1439c84b64facaf7d2875adc29110c65cf4.tar.xz
hercules-b9f7d1439c84b64facaf7d2875adc29110c65cf4.zip
Merge pull request #2713 from 4144/updatepackets
Update packets up to 2020-05-20
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 069b98eef..09e4f3301 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -19152,7 +19152,14 @@ static BUILDIN(npcshopdelitem)
size--;
}
- RECREATE(nd->u.shop.shop_item, struct npc_item_list, size);
+ int alloc_size = size;
+ if (size < 0) {
+ size = 0;
+ alloc_size = 1;
+ } else if (size < 1) {
+ alloc_size = 1;
+ }
+ RECREATE(nd->u.shop.shop_item, struct npc_item_list, alloc_size);
nd->u.shop.count = size;
script_pushint(st,1);