Skip to content

Commit

Permalink
SpellsLvl07: Check if target entity is valid
Browse files Browse the repository at this point in the history
Fixes: Issue #1027
  • Loading branch information
bsxf-47 authored and Eli2 committed Jun 19, 2017
1 parent 08b065b commit 641131c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/game/magic/spells/SpellsLvl07.cpp
Expand Up @@ -679,14 +679,19 @@ void ConfuseSpell::End() {

void ConfuseSpell::Update() {

Vec3f pos = entities[m_target]->pos;
Entity *target = entities.get(m_target);
if(!target) {
return;
}

Vec3f pos = target->pos;
if(m_target != EntityHandle_Player) {
pos.y += entities[m_target]->physics.cyl.height - 30.f;
pos.y += target->physics.cyl.height - 30.f;
}

ObjVertHandle idx = entities[m_target]->obj->fastaccess.head_group_origin;
ObjVertHandle idx = target->obj->fastaccess.head_group_origin;
if(idx != ObjVertHandle()) {
pos = entities[m_target]->obj->vertexWorldPositions[idx.handleData()].v;
pos = target->obj->vertexWorldPositions[idx.handleData()].v;
pos.y -= 50.f;
}

Expand Down

0 comments on commit 641131c

Please sign in to comment.