Fixes crash if card count is not sufficient for evaluation

bs
Laurent 5 years ago
parent 1d7bf536db
commit c007ac1174
  1. 14
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/evaluator/EvaluatorBridge.kt

@ -51,12 +51,14 @@ class EvaluatorBridge {
val bcArray = boardCards.toTypedArray()
val hcArray = handCards.toTypedArray()
Combinator.combinations(bcArray, 3, 0, arrayOfNulls(3)) { bc ->
Combinator.combinations(hcArray, 2, 0, arrayOfNulls(2)) { hc ->
val fcc = arrayOf<net.pokeranalytics.android.ui.modules.handhistory.evaluator.Card?>()
fcc.plus(bc) // Five Card Combination
fcc.plus(hc)
result = min(result, Hand.evaluate(fcc))
if (bcArray.size >= 3 && hcArray.size >= 2) {
Combinator.combinations(bcArray, 3, 0, arrayOfNulls(3)) { bc ->
Combinator.combinations(hcArray, 2, 0, arrayOfNulls(2)) { hc ->
val fcc = arrayOf<net.pokeranalytics.android.ui.modules.handhistory.evaluator.Card?>()
fcc.plus(bc) // Five Card Combination
fcc.plus(hc)
result = min(result, Hand.evaluate(fcc))
}
}
}
}

Loading…
Cancel
Save