From 3d28a815089fd0a878a6a1d469db657c6030d4b2 Mon Sep 17 00:00:00 2001 From: bash <31279994+hermensbas@users.noreply.github.com> Date: Sun, 10 Aug 2025 19:31:10 +0200 Subject: [PATCH] nullptr exception (#1520) --- src/factory/PlayerbotFactory.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/factory/PlayerbotFactory.cpp b/src/factory/PlayerbotFactory.cpp index 0fe95176..24c130d7 100644 --- a/src/factory/PlayerbotFactory.cpp +++ b/src/factory/PlayerbotFactory.cpp @@ -164,15 +164,16 @@ void PlayerbotFactory::Init() { continue; } + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(gemId); + if (proto) { + if (proto->ItemLevel < 60) + continue; - if (proto->ItemLevel < 60) - continue; - - if (proto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE) - { - continue; + if (proto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE) + continue; } + if (sRandomItemMgr->IsTestItem(gemId)) continue; @@ -180,9 +181,11 @@ void PlayerbotFactory::Init() { continue; } + // LOG_INFO("playerbots", "Add {} to enchantment gems", gemId); enchantGemIdCache.push_back(gemId); } + LOG_INFO("playerbots", "Loading {} enchantment gems", enchantGemIdCache.size()); }