Skip to content

Commit 9d03023

Browse files
committed
be more tolerant when no project is set
1 parent 5a58339 commit 9d03023

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ allprojects {
2424
}
2525

2626
project.ext {
27-
sdkVersion='0.9.0-beta10'
27+
sdkVersion='0.9.0-beta11'
2828
versionCode=1
2929

3030
compileSdkVersion=28

ui-integration/src/main/java/io/snabble/sdk/ui/integration/CheckoutFragment.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.view.ViewGroup;
88

99
import io.snabble.sdk.Checkout;
10+
import io.snabble.sdk.Project;
1011
import io.snabble.sdk.ui.SnabbleUI;
1112
import io.snabble.sdk.ui.telemetry.Telemetry;
1213

@@ -20,12 +21,16 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
2021
public void onDestroyView() {
2122
super.onDestroyView();
2223

23-
Checkout checkout = SnabbleUI.getProject().getCheckout();
24-
checkout.cancel();
24+
Project project = SnabbleUI.getProject();
2525

26-
if(checkout.getState() != Checkout.State.PAYMENT_APPROVED
27-
&& checkout.getState() != Checkout.State.NONE) {
28-
Telemetry.event(Telemetry.Event.CheckoutAbortByUser);
26+
if(project != null) {
27+
Checkout checkout = project.getCheckout();
28+
checkout.cancel();
29+
30+
if (checkout.getState() != Checkout.State.PAYMENT_APPROVED
31+
&& checkout.getState() != Checkout.State.NONE) {
32+
Telemetry.event(Telemetry.Event.CheckoutAbortByUser);
33+
}
2934
}
3035
}
3136
}

0 commit comments

Comments
 (0)