Skip to content

Commit

Permalink
add checks before calling checkOptionalObjectiveAmountWinCondition
Browse files Browse the repository at this point in the history
  • Loading branch information
sookmax committed Jun 17, 2024
1 parent f87c179 commit 2b94409
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions apollo/lib/checkWinCondition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,17 @@ export default function checkWinConditions(
return null;
}

const optionalObjectiveAmount = checkOptionalObjectiveAmountWinCondition(
map,
actionResponse,
);
if (optionalObjectiveAmount) {
return optionalObjectiveAmount;
if (
actionResponse.type === 'OptionalObjective' ||
actionResponse.type === 'DeniedOptionalObjective'
) {
const optionalObjectiveAmount = checkOptionalObjectiveAmountWinCondition(
map,
actionResponse,
);
if (optionalObjectiveAmount) {
return optionalObjectiveAmount;
}
}

const isDestructive = isDestructiveAction(actionResponse);
Expand Down

0 comments on commit 2b94409

Please sign in to comment.