mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fix possible crash
This commit is contained in:
@@ -182,11 +182,11 @@ WorldObject* LootObject::GetWorldObject(Player* bot)
|
||||
return nullptr;
|
||||
}
|
||||
Creature* creature = botAI->GetCreature(guid);
|
||||
if (creature && creature->getDeathState() == DeathState::Corpse)
|
||||
if (creature && creature->getDeathState() == DeathState::Corpse && creature->IsInWorld())
|
||||
return creature;
|
||||
|
||||
GameObject* go = botAI->GetGameObject(guid);
|
||||
if (go && go->isSpawned())
|
||||
if (go && go->isSpawned() && go->IsInWorld())
|
||||
return go;
|
||||
|
||||
return nullptr;
|
||||
|
||||
@@ -19,7 +19,7 @@ float DistanceValue::Calculate()
|
||||
return 0.0f;
|
||||
|
||||
WorldObject* obj = loot.GetWorldObject(bot);
|
||||
if (!obj)
|
||||
if (!obj || !obj->IsInWorld())
|
||||
return 0.0f;
|
||||
|
||||
return sServerFacade->GetDistance2d(botAI->GetBot(), obj);
|
||||
|
||||
Reference in New Issue
Block a user