diff --git a/Source/spells.cpp b/Source/spells.cpp index fbe2481a9..e5fa51df4 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -247,7 +247,7 @@ void CastSpell(int id, spell_id spl, int sx, int sy, int dx, int dy, int spllvl) dir = Players[id].tempDirection; } - for (int i = 0; spelldata[spl].sMissiles[i] != MIS_NULL && i < 3; i++) { + for (int i = 0; i < 3 && spelldata[spl].sMissiles[i] != MIS_NULL; i++) { AddMissile({ sx, sy }, { dx, dy }, dir, spelldata[spl].sMissiles[i], TARGET_MONSTERS, id, 0, spllvl); }