[Crash Fix] Guard against Spells:MaxTotalSlotsPET being set above client allowed maximum. (#3507)

* Guard against MaxTotalSlotsPET being set too high

This prevents a crash from MaxTotalSlotsPET being set too high.

* Tweak
This commit is contained in:
Vayle 2023-07-22 10:20:22 -04:00 committed by GitHub
parent b5652e6010
commit c30074be66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3303,7 +3303,8 @@ void ZoneDatabase::SavePetInfo(Client *client)
// build pet buffs into struct // build pet buffs into struct
int pet_buff_count = 0; int pet_buff_count = 0;
int max_slots = RuleI(Spells, MaxTotalSlotsPET); // Guard against setting the maximum pet slots above the client allowed maximum.
int max_slots = RuleI(Spells, MaxTotalSlotsPET) > PET_BUFF_COUNT ? PET_BUFF_COUNT : RuleI(Spells, MaxTotalSlotsPET);
// count pet buffs // count pet buffs
for (int index = 0; index < max_slots; index++) { for (int index = 0; index < max_slots; index++) {