Fix crash

This commit is contained in:
Phillip Thelen 2022-07-07 11:44:04 +02:00
parent c6957adae9
commit 19217707dc

View file

@ -44,6 +44,7 @@ import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.launch
@ -308,7 +309,7 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
if (shopItem.isValid && !shopItem.locked) {
val gemsLeft = if (shopItem.limitedNumberLeft != null) shopItem.limitedNumberLeft else 0
if ((gemsLeft == 0 && shopItem.purchaseType == "gems") || shopItem.canAfford(user, purchaseQuantity)) {
GlobalScope.launch {
MainScope().launch(Dispatchers.Main) {
remainingPurchaseQuantity { quantity ->
if (quantity >= 0) {
if (quantity < purchaseQuantity) {