From b71d97b9fc19f5e29fbc7482b63b70ab5a994292 Mon Sep 17 00:00:00 2001 From: bash <31279994+hermensbas@users.noreply.github.com> Date: Sun, 10 Aug 2025 21:19:19 +0200 Subject: [PATCH] nullptr fix --- src/factory/PlayerbotFactory.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/factory/PlayerbotFactory.cpp b/src/factory/PlayerbotFactory.cpp index 24c130d7..32d495a7 100644 --- a/src/factory/PlayerbotFactory.cpp +++ b/src/factory/PlayerbotFactory.cpp @@ -1020,14 +1020,16 @@ void PlayerbotFactory::ClearSkills() } bot->SetUInt32Value(PLAYER_SKILL_INDEX(0), 0); bot->SetUInt32Value(PLAYER_SKILL_INDEX(1), 0); + // unlearn default race/class skills - PlayerInfo const* info = sObjectMgr->GetPlayerInfo(bot->getRace(), bot->getClass()); - for (PlayerCreateInfoSkills::const_iterator itr = info->skills.begin(); itr != info->skills.end(); ++itr) - { - uint32 skillId = itr->SkillId; - if (!bot->HasSkill(skillId)) - continue; - bot->SetSkill(skillId, 0, 0, 0); + if (PlayerInfo const* info = sObjectMgr->GetPlayerInfo(bot->getRace(), bot->getClass())) { + for (PlayerCreateInfoSkills::const_iterator itr = info->skills.begin(); itr != info->skills.end(); ++itr) + { + uint32 skillId = itr->SkillId; + if (!bot->HasSkill(skillId)) + continue; + bot->SetSkill(skillId, 0, 0, 0); + } } }