Include check for negative index in setting party leader
This commit is contained in:
parent
7d77aab3fc
commit
0e33206e47
1 changed files with 1 additions and 8 deletions
|
@ -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];
|
||||||
|
|
Loading…
Reference in a new issue