From cc138e8c9be16e595073819dd645fc800e36ce3c Mon Sep 17 00:00:00 2001 From: najoast Date: Wed, 31 May 2023 06:49:55 +0800 Subject: [PATCH] fix: crash caused by VendorRemoveAllItems (#142) --- src/LuaEngine/GlobalMethods.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LuaEngine/GlobalMethods.h b/src/LuaEngine/GlobalMethods.h index 8545f73..3003a5a 100644 --- a/src/LuaEngine/GlobalMethods.h +++ b/src/LuaEngine/GlobalMethods.h @@ -2066,7 +2066,7 @@ namespace LuaGlobalFunctions return 0; auto const& itemlist = items->m_items; - for (auto itr = itemlist.begin(); itr != itemlist.end(); ++itr) + for (auto itr = itemlist.rbegin(); itr != itemlist.rend(); ++itr) #if defined(CATA) || defined(MISTS) eObjectMgr->RemoveVendorItem(entry, (*itr)->item, 1); #else