Skip to content

Fix/app crash on double cancele google py go sell#65

Open
HumedMohammed wants to merge 2 commits intoTap-Payments:masterfrom
HumedMohammed:fix/app-crash-on-double-cancele-google-py-goSell
Open

Fix/app crash on double cancele google py go sell#65
HumedMohammed wants to merge 2 commits intoTap-Payments:masterfrom
HumedMohammed:fix/app-crash-on-double-cancele-google-py-goSell

Conversation

@HumedMohammed
Copy link
Copy Markdown

No description provided.

- It was causing app crash in this scenarios:-
start goSell-->click google pay --> close google pay --> close goSell --> app crash
@HumedMohammed
Copy link
Copy Markdown
Author

HumedMohammed commented Dec 2, 2025

Found crash reproducer

Steps:

  • Start GoSell SDK
  • Tap Google Pay
  • Close Google Pay UI
  • Close GoSell SDK UI
  • App crashes

Suspected root causes in [GoSellSdKDelegate.java]

  • paymentInitiated(): uses charge.getResponse().getMessage() and other getters without null-checks — NPE risk if response/customer/acquirer/source are null.
  • sendChargeResult(): many dereferences (charge.getResponse(), charge.getCard(), charge.getAcquirer(), charge.getSource(), charge.getCustomer()) with incomplete null-safety.
  • sendSavedCardResult(): casts to SaveCard and calls ((SaveCard) charge).getPaymentAgreement() without ensuring charge instanceof SaveCard first — possible ClassCastException.
  • terminatePayment(): cancelling the SDK while Google Pay or SDK UI is closing can race with callbacks; ensure cancelSession is called safely on UI thread and session delegate removed or guarded.

Immediate recommended fixes

  • Add null checks before calling getters (response, card, acquirer, source, customer).
  • Avoid casting to SaveCard unless instanceof check passes; early-return or fallback if not SaveCard.
  • Ensure sdkSession.cancelSession(activity) is called on the UI thread and only if session is active; consider removing session delegate before cancel.
  • Guard all callback invocations (callback != null) — already partially handled but verify everywhere.

@HumedMohammed
Copy link
Copy Markdown
Author

Before Fix (App Crash)

screen-20251202-174347.mp4

After Fix (No Crash)

screen-20251202-174542.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant