Skip to content

Commit

Permalink
fix IndexOutOfBoundsException when MandatoryCards.Count == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSwerik committed Nov 10, 2024
1 parent c9e7e9b commit 55154de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Game/GameBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1605,15 +1605,15 @@ private void OnSelectSum(BinaryReader packet)

IList<ClientCard> SelectSumRecursive(int cardIndex, int sumVal)
{
if (cardIndex >= mandatoryCards.Count) return _ai.OnSelectSum(cards, sumVal, min, max, _select_hint, mode);

ClientCard card = mandatoryCards[cardIndex];
for (int opParam = 0; opParam < 2; opParam++)
{
int opParamValue = opParam == 0 ? card.OpParam1 : card.OpParam2;
int tempSumVal = sumVal - opParamValue;

IList<ClientCard> tempResult = cardIndex == mandatoryCards.Count - 1
? _ai.OnSelectSum(cards, tempSumVal, min, max, _select_hint, mode)
: SelectSumRecursive(cardIndex + 1, tempSumVal);
IList<ClientCard> tempResult = SelectSumRecursive(cardIndex + 1, tempSumVal);
if (tempResult.Count >= min) return tempResult;
}

Expand Down

0 comments on commit 55154de

Please sign in to comment.