1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-30 16:20:21 +00:00

Don't call getClass on an empty Ptr

This commit is contained in:
Evil Eye 2022-12-26 21:13:24 +01:00
parent 7a0635aeee
commit 1cf0befd07

View File

@ -628,7 +628,8 @@ namespace MWMechanics
} }
std::set<MWWorld::Ptr> playerAllies; std::set<MWWorld::Ptr> playerAllies;
getActorsSidingWith(MWMechanics::getPlayer(), playerAllies, cachedAllies); MWWorld::Ptr player = MWMechanics::getPlayer();
getActorsSidingWith(player, playerAllies, cachedAllies);
bool isPlayerFollowerOrEscorter = playerAllies.find(actor1) != playerAllies.end(); bool isPlayerFollowerOrEscorter = playerAllies.find(actor1) != playerAllies.end();
@ -651,7 +652,8 @@ namespace MWMechanics
mechanicsManager->startCombat(actor1, actor2); mechanicsManager->startCombat(actor1, actor2);
// Also have actor1's allies start combat // Also have actor1's allies start combat
for (const MWWorld::Ptr& ally1 : allies1) for (const MWWorld::Ptr& ally1 : allies1)
mechanicsManager->startCombat(ally1, actor2); if (ally1 != player)
mechanicsManager->startCombat(ally1, actor2);
return; return;
} }
} }
@ -756,6 +758,8 @@ namespace MWMechanics
MWWorld::Ptr caster MWWorld::Ptr caster
= MWBase::Environment::get().getWorld()->searchPtrViaActorId(spell.getCasterActorId()); = MWBase::Environment::get().getWorld()->searchPtrViaActorId(spell.getCasterActorId());
if (caster.isEmpty())
continue;
for (const auto& effect : spell.getEffects()) for (const auto& effect : spell.getEffects())
{ {
static const std::array<int, 7> damageEffects{ static const std::array<int, 7> damageEffects{