Include check for negative index in setting party leader

This commit is contained in:
William Brawner 2021-05-18 20:01:56 -06:00 committed by seedhartha
parent 7d77aab3fc
commit 0e33206e47

View file

@ -187,14 +187,7 @@ void Party::setPartyLeader(int npc) {
} }
void Party::setPartyLeaderByIndex(int index) { void Party::setPartyLeaderByIndex(int index) {
if (index == 0) { if (index < 1 || index >= _members.size()) return;
warn("Party: attempted to switch leader to current party member: " + to_string(index));
return;
}
if (index >= _members.size()) {
warn("Party: index out of range: " + to_string(index));
return;
}
Member tmp(_members[0]); Member tmp(_members[0]);
_members[0] = _members[index]; _members[0] = _members[index];