Skip to content

Commit

Permalink
Put extra protection in repositioning quests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinematics committed May 8, 2024
1 parent d2855f0 commit bc5c507
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions NetTally.Core/Configure/QuestsInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ public void RepositionQuest(Quest? quest)
break;
}

if (newIndex >= Quests.Count)
newIndex = Quests.Count - 1;

if (index == newIndex)
return;

Quests.Move(index, newIndex);

logger.LogDebug("Moved quest {name} from position {start} to position {end}.", quest.DisplayName, index, newIndex);
Expand Down

0 comments on commit bc5c507

Please sign in to comment.