Skip to content

Commit 2c67ba2

Browse files
authored
bugfix: App crashing when user not logged in Cafebazaar
App was crashing when user not logged in Cafebazaar. it was due to forgotten `else` and both rejecting and resolving the promise.
1 parent 792cfc1 commit 2c67ba2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

android/app/src/main/java/com/contoriel/cafebazaar/CafeBazaar.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,11 @@ public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
124124
promise.reject(E_SETUP_DISCONNECT,"there no connection to cafe bazaar!");
125125
}
126126
// Is it a failure?
127-
if (result.isFailure()) {
127+
else if (result.isFailure()) {
128128
promise.reject(E_LAYOUT_ERROR,"Failed to query inventory: " + result.getMessage());
129-
}
129+
} else {
130130
promise.resolve(gson.toJson(inventory));
131+
}
131132
}
132133
});
133134
}
@@ -142,11 +143,12 @@ public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
142143
promise.reject(E_SETUP_DISCONNECT,"there no connection to cafe bazaar!");
143144
}
144145
// Is it a failure?
145-
if (result.isFailure()) {
146+
else if (result.isFailure()) {
146147
promise.reject(E_LOAD_ITEMS_FAILURE,result.getMessage());
148+
} else {
149+
userInvo = inventory;
150+
promise.resolve(gson.toJson(inventory.getAllOwnedSkus()));
147151
}
148-
userInvo = inventory;
149-
promise.resolve(gson.toJson(inventory.getAllOwnedSkus()));
150152
}
151153
});
152154
}

0 commit comments

Comments
 (0)