Fixed crash on deleting soul balls (#5077)

Fixes #5076
This commit is contained in:
Sader Fawall 2020-06-10 23:31:53 +02:00 committed by GitHub
parent 39fb658810
commit f481cc9c46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -641,8 +641,8 @@ int pc_delsoulball(struct map_session_data *sd, int count, int type)
if (count > sd->soulball)
count = sd->soulball;
sd->soulball -= count;
if (count > MAX_SKILL_LEVEL)
count = MAX_SKILL_LEVEL;
if (count > MAX_SOUL_BALL)
count = MAX_SOUL_BALL;
for (int i = 0; i < count; i++) {
if (sd->soul_timer[i] != INVALID_TIMER) {
@ -651,7 +651,7 @@ int pc_delsoulball(struct map_session_data *sd, int count, int type)
}
}
for (int i = count; i < MAX_SKILL_LEVEL; i++) {
for (int i = count; i < MAX_SOUL_BALL; i++) {
sd->soul_timer[i - count] = sd->soul_timer[i];
sd->soul_timer[i] = INVALID_TIMER;
}