From 675abb50118e7e74c52fe3acbf93fbdf1adca79d Mon Sep 17 00:00:00 2001 From: johan12345 Date: Sun, 12 Feb 2023 17:40:06 +0100 Subject: [PATCH] DonateViewModel: fix possible NPE when loading products see also https://github.com/EventFahrplan/EventFahrplan/issues/71 --- .../net/vonforst/evmap/viewmodel/DonateViewModel.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/google/java/net/vonforst/evmap/viewmodel/DonateViewModel.kt b/app/src/google/java/net/vonforst/evmap/viewmodel/DonateViewModel.kt index 73b6672a..b4d77789 100644 --- a/app/src/google/java/net/vonforst/evmap/viewmodel/DonateViewModel.kt +++ b/app/src/google/java/net/vonforst/evmap/viewmodel/DonateViewModel.kt @@ -15,6 +15,12 @@ class DonateViewModel(application: Application) : AndroidViewModel(application), .setListener(this) .enablePendingPurchases() .build() + + val products: MutableLiveData>> by lazy { + MutableLiveData>>().apply { + value = Resource.loading(null) + } + } init { billingClient.startConnection(object : BillingClientStateListener { @@ -70,12 +76,6 @@ class DonateViewModel(application: Application) : AndroidViewModel(application), } } - val products: MutableLiveData>> by lazy { - MutableLiveData>>().apply { - value = Resource.loading(null) - } - } - val purchaseSuccessful = SingleLiveEvent() val purchaseFailed = SingleLiveEvent()