fix(Core): Fixed a few crashes/bugs that were found via static code analysis (#2617)

This commit is contained in:
Kaev
2020-01-25 14:26:38 +01:00
committed by Stoabrogga
parent 1bbe10dc33
commit 999d588c37
21 changed files with 80 additions and 59 deletions

View File

@@ -395,11 +395,12 @@ public:
}
// ensure LMK2 is at proper position
if (Creature* LMK2 = GetLMK2())
{
LMK2->UpdatePosition(LMK2->GetHomePosition(), true);
LMK2->StopMovingOnCurrentPos();
}
if (pInstance)
if (Creature* LMK2 = GetLMK2())
{
LMK2->UpdatePosition(LMK2->GetHomePosition(), true);
LMK2->StopMovingOnCurrentPos();
}
if (pInstance && pInstance->GetData(TYPE_MIMIRON) != DONE)
pInstance->SetData(TYPE_MIMIRON, IN_PROGRESS);

View File

@@ -2312,8 +2312,14 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* owner = GetUnitOwner();
if (!owner)
{
SetDuration(0);
return;
}
Unit* _target = ObjectAccessor::GetUnit(*owner, _targetGUID);
if (!owner || !_target || !_target->IsAlive() || fabs(owner->GetPositionZ() - _target->GetPositionZ()) > 10.0f) // Target or owner underground
if (!_target || !_target->IsAlive() || fabs(owner->GetPositionZ() - _target->GetPositionZ()) > 10.0f) // Target or owner underground
{
SetDuration(0);
return;