Skip to content

Commit 1567d25

Browse files
author
Omid Golshan
authored
Merge pull request #2 from arashmilani/master
bugfix: App crashing when user not logged in Cafebazaar.
2 parents 06488c6 + 1188162 commit 1567d25

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
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
}

android/app/src/main/java/com/contoriel/cafebazaar/util/IabHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public void dispose() {
289289
mSetupDone = false;
290290
if (mServiceConn != null) {
291291
logDebug("Unbinding from service.");
292-
if (mContext != null) mContext.unbindService(mServiceConn);
292+
if (mContext != null && mService != null) mContext.unbindService(mServiceConn);
293293
}
294294
mDisposed = true;
295295
mContext = null;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@
8989
"start": "node node_modules/react-native/local-cli/cli.js start",
9090
"test": "jest"
9191
},
92-
"version": "1.0.0"
92+
"version": "1.0.1"
9393
}

0 commit comments

Comments
 (0)