From f2b1a84ef4d3ea44ab3496c1f541dce180ec933f Mon Sep 17 00:00:00 2001 From: dongresource Date: Sat, 6 Mar 2021 02:09:21 +0100 Subject: [PATCH] Fix segfault when redeeming more than four items at once --- src/ChatManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ChatManager.cpp b/src/ChatManager.cpp index d278c5e..2cf0df6 100644 --- a/src/ChatManager.cpp +++ b/src/ChatManager.cpp @@ -762,10 +762,10 @@ void redeemCommand(std::string full, std::vector& args, CNSocket* s } int itemCount = ItemManager::CodeItems[code].size(); - int slots[4]; + std::vector slots; for (int i = 0; i < itemCount; i++) { - slots[i] = ItemManager::findFreeSlot(plr); + slots.push_back(ItemManager::findFreeSlot(plr)); if (slots[i] == -1) { ChatManager::sendServerMessage(sock, "/redeem: Not enough space in inventory");