From 6fe994a297383d054b07eaa3d11b046e3f43ea60 Mon Sep 17 00:00:00 2001
From: Ghazi Akmal Fauzan <13521058@std.stei.itb.ac.id>
Date: Thu, 4 Apr 2024 15:06:28 +0700
Subject: [PATCH] fix: transaction statistic null value

Fixed by Nigel
---
 .../example/nerbos/fragments/statistic/StatisticFragment.kt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/src/main/java/com/example/nerbos/fragments/statistic/StatisticFragment.kt b/app/src/main/java/com/example/nerbos/fragments/statistic/StatisticFragment.kt
index df203cb..127c178 100644
--- a/app/src/main/java/com/example/nerbos/fragments/statistic/StatisticFragment.kt
+++ b/app/src/main/java/com/example/nerbos/fragments/statistic/StatisticFragment.kt
@@ -84,9 +84,9 @@ class StatisticFragment : Fragment() {
 
             // Observing the result
             result.observe(viewLifecycleOwner) {
-                if (income.value != null && outcome.value != null) {
-                    sumIncome = income.value!!
-                    sumOutcome = outcome.value!!
+                if (income.value != null || outcome.value != null) {
+                    sumIncome = income.value ?: 0.0f
+                    sumOutcome = outcome.value ?: 0.0f
                     liveDataReady.postValue(true)
                 }
             }
-- 
GitLab