Skip to content

Commit 46053cc

Browse files
committed
instead of throwing an exception and crushing the app the fab button does nothing until a project is set
1 parent c8367f5 commit 46053cc

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

ui/src/main/java/io/snabble/sdk/ui/payment/PaymentCredentialsListView.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,11 @@ public void click() {
100100
if (p == null) {
101101
p = Snabble.getInstance().getCheckedInProject().getValue();
102102
}
103-
104-
if (p == null) {
105-
throw new IllegalStateException("Cannot get current project. Did you forget to set the projectId to the PaymentCredentialsListFragment or PaymentCredentialsListView?");
103+
if (p != null) {
104+
bundle.putString(SelectPaymentMethodFragment.ARG_PROJECT_ID, p.getId());
105+
dialogFragment.setArguments(bundle);
106+
dialogFragment.show(((FragmentActivity) activity).getSupportFragmentManager(), null);
106107
}
107-
108-
bundle.putString(SelectPaymentMethodFragment.ARG_PROJECT_ID, p.getId());
109-
dialogFragment.setArguments(bundle);
110-
dialogFragment.show(((FragmentActivity) activity).getSupportFragmentManager(), null);
111108
} else {
112109
throw new RuntimeException("Host activity must be a Fragment Activity");
113110
}

0 commit comments

Comments
 (0)