From 637a34efd749fcc952e92a41c894455b7d824ba0 Mon Sep 17 00:00:00 2001 From: Fabian Zobrist Date: Sat, 24 Dec 2022 15:00:41 +0100 Subject: [PATCH] Fix app crash --- .../me/zobrist/tichucounter/fragments/HistoryListViewModel.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/me/zobrist/tichucounter/fragments/HistoryListViewModel.kt b/app/src/main/java/me/zobrist/tichucounter/fragments/HistoryListViewModel.kt index 3f5950c..647ef0f 100644 --- a/app/src/main/java/me/zobrist/tichucounter/fragments/HistoryListViewModel.kt +++ b/app/src/main/java/me/zobrist/tichucounter/fragments/HistoryListViewModel.kt @@ -39,7 +39,7 @@ class HistoryListViewModel : ViewModel() { private fun getScoreA() { var tempScore = 0 scores.forEach { - tempScore += it.scoreA!! + it.scoreA?.let { it -> tempScore += it } } _totalScoreA.value = tempScore } @@ -47,7 +47,7 @@ class HistoryListViewModel : ViewModel() { private fun getScoreB() { var tempScore = 0 scores.forEach { - tempScore += it.scoreB!! + it.scoreB?.let {it -> tempScore += it} } _totalScoreB.value = tempScore }