From 886c4095d5eb6d7e9017725154907208413e09c9 Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 2 Feb 2021 11:37:16 +0100 Subject: [PATCH] Fixes a crash when setting straddle then changing the number of players --- .../android/ui/modules/handhistory/model/EditorViewModel.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/EditorViewModel.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/EditorViewModel.kt index 28c8c2b6..92bb224b 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/EditorViewModel.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/EditorViewModel.kt @@ -423,6 +423,12 @@ class EditorViewModel : ViewModel(), RowRepresentableDataSource, CardCentralizer if (playerCount != this.handHistory.numberOfPlayers) { this.clearSelection() // avoid crashes this.handSetup.tableSize = playerCount + + if (this.handSetup.straddlePositions.isNotEmpty()) { // avoid possible crashes + this.handSetup.clearStraddles() + this.straddlePositions.clear() + } + this.handHistory.configure(this.handSetup) load() }