From a04c3321e713d58d87b209b5e3af21fcf678c12b Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 12 May 2016 09:34:48 +0100 Subject: [PATCH] Always set next to null after memcpy. --- src/battle/items.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/battle/items.c b/src/battle/items.c index 56055f8..90e1099 100644 --- a/src/battle/items.c +++ b/src/battle/items.c @@ -71,6 +71,8 @@ Entity *spawnItem(char *name) memcpy(item, def, sizeof(Entity)); + item->next = NULL; + item->action = action; return item; @@ -91,8 +93,11 @@ void addRandomItem(int x, int y) } item = spawnEntity(); + memcpy(item, def, sizeof(Entity)); + item->next = NULL; + item->x = x; item->y = y; item->speed = 1;