From 29613e29b7acac1bb14fd5574d4c9460c024af85 Mon Sep 17 00:00:00 2001 From: Keleborn <22352763+Celandriel@users.noreply.github.com> Date: Wed, 14 Jan 2026 15:42:37 -0800 Subject: [PATCH] Bug - Selfbot can trigger crash in printstats (#2013) Adding a guard against bots that may be registered in `playerBots` variable as selfbot have appeared to crash here. Edit: The exact circumstances that caused the incorrect registration are under investigation as it seems to be 'atypical' behavior. --- src/RandomPlayerbotMgr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index 0b666b9a..c087276f 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -3214,6 +3214,12 @@ void RandomPlayerbotMgr::PrintStats() lvlPerRace[bot->getRace()] += bot->GetLevel(); PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot); + if (!botAI) + { + LOG_ERROR("playerbots", "Player/Bot {} is registered in sRandomPlayerbotMgr playerBots and has no bot AI!", bot->GetName().c_str()); + continue; + } + if (botAI->AllowActivity()) ++active;