mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-17 11:19:01 +00:00
Fix crash
This commit is contained in:
parent
c6957adae9
commit
19217707dc
1 changed files with 2 additions and 1 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue