diff --git a/engines/saga2/magic.cpp b/engines/saga2/magic.cpp index 6a6117e46a8..9c360b53781 100644 --- a/engines/saga2/magic.cpp +++ b/engines/saga2/magic.cpp @@ -95,15 +95,15 @@ GameObject *GetOwner(GameObject *go) { // This call looks up a spells object prototype. It can accept either // an object ID or a spell ID SkillProto *skillProtoFromID(int16 spellOrObjectID) { - if (spellOrObjectID > MAX_SPELLS) - return (SkillProto *) GameObject::protoAddress(spellOrObjectID); + if (spellOrObjectID >= MAX_SPELLS) + return (SkillProto *)GameObject::protoAddress(spellOrObjectID); return spellBook[spellOrObjectID].getProto(); } //----------------------------------------------------------------------- // initialization call to connect skill prototypes with their spells void initializeSkill(SkillProto *oNo, SpellID sNo) { - if (sNo > 0 && sNo <= MAX_SPELLS - 1) { + if (sNo > 0 && sNo < MAX_SPELLS) { if (spellBook[sNo].getProto() != NULL) error("Duplicate prototype for spell %d", sNo); spellBook[sNo].setProto(oNo);