nullptr fix (#1557)

* nullptr fix

* Update PlayerbotFactory.cpp
This commit is contained in:
bash
2025-08-16 15:29:09 +02:00
committed by GitHub
parent 3e0f23536d
commit 6cb9f56c4e

View File

@@ -164,22 +164,33 @@ void PlayerbotFactory::Init()
{ {
continue; continue;
} }
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(gemId); ItemTemplate const* proto = sObjectMgr->GetItemTemplate(gemId);
if (!proto)
if (proto->ItemLevel < 60) {
continue; continue;
}
if (proto->ItemLevel < 60)
{
continue;
}
if (proto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE) if (proto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE)
{ {
continue; continue;
} }
if (sRandomItemMgr->IsTestItem(gemId)) if (sRandomItemMgr->IsTestItem(gemId))
continue; {
continue;
if (!proto || !sGemPropertiesStore.LookupEntry(proto->GemProperties)) }
if (!sGemPropertiesStore.LookupEntry(proto->GemProperties))
{ {
continue; continue;
} }
// LOG_INFO("playerbots", "Add {} to enchantment gems", gemId); // LOG_INFO("playerbots", "Add {} to enchantment gems", gemId);
enchantGemIdCache.push_back(gemId); enchantGemIdCache.push_back(gemId);
} }