@@ -421,8 +421,10 @@ public void onPaymentError(String errorMessage) {
421421 @ Override
422422 public void collectCardPin (final Payload payload ) {
423423 this .payLoad = payload ; //added so as to get back in onActivityResult
424- new RaveVerificationUtils (this , ravePayInitializer .isStaging (), ravePayInitializer .getPublicKey (), ravePayInitializer .getTheme ())
425- .showPinScreen ();
424+ if (isAdded ()){
425+ new RaveVerificationUtils (this , ravePayInitializer .isStaging (), ravePayInitializer .getPublicKey (), ravePayInitializer .getTheme ())
426+ .showPinScreen ();
427+ }
426428 }
427429
428430 @ Override
@@ -510,15 +512,19 @@ private void dismissDialog() {
510512 public void collectOtp (String flwRef , String message ) {
511513 this .flwRef = flwRef ;
512514 dismissDialog ();
513- new RaveVerificationUtils (this , ravePayInitializer .isStaging (), ravePayInitializer .getPublicKey (), ravePayInitializer .getTheme ())
514- .showOtpScreen (message );
515+ if (isAdded ()){
516+ new RaveVerificationUtils (this , ravePayInitializer .isStaging (), ravePayInitializer .getPublicKey (), ravePayInitializer .getTheme ())
517+ .showOtpScreen (message );
518+ }
515519 }
516520
517521 public void showOTPLayoutForSavedCard (Payload payload , String authInstruction ) {
518522 this .payLoad = payload ;
519523 dismissDialog ();
520- new RaveVerificationUtils (this , ravePayInitializer .isStaging (), ravePayInitializer .getPublicKey (), ravePayInitializer .getTheme ())
521- .showOtpScreenForSavedCard (authInstruction );
524+ if (isAdded ()){
525+ new RaveVerificationUtils (this , ravePayInitializer .isStaging (), ravePayInitializer .getPublicKey (), ravePayInitializer .getTheme ())
526+ .showOtpScreenForSavedCard (authInstruction );
527+ }
522528 }
523529
524530 @ Override
@@ -578,8 +584,10 @@ public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction)
578584 public void showWebPage (String authenticationUrl , String flwRef ) {
579585
580586 this .flwRef = flwRef ;
581- new RaveVerificationUtils (this , ravePayInitializer .isStaging (), ravePayInitializer .getPublicKey (), ravePayInitializer .getTheme ())
582- .showWebpageVerificationScreen (authenticationUrl );
587+ if (isAdded ()){
588+ new RaveVerificationUtils (this , ravePayInitializer .isStaging (), ravePayInitializer .getPublicKey (), ravePayInitializer .getTheme ())
589+ .showWebpageVerificationScreen (authenticationUrl );
590+ }
583591 }
584592
585593 @ Override
@@ -776,8 +784,10 @@ public void onClick(DialogInterface dialog, int which) {
776784 public void collectCardAddressDetails (final Payload payload , String authModel ) {
777785 this .payLoad = payload ;
778786 this .authModel = authModel ;
779- new RaveVerificationUtils (this , ravePayInitializer .isStaging (), ravePayInitializer .getPublicKey (), ravePayInitializer .getTheme ())
780- .showAddressScreen ();
787+ if (isAdded ()){
788+ new RaveVerificationUtils (this , ravePayInitializer .isStaging (), ravePayInitializer .getPublicKey (), ravePayInitializer .getTheme ())
789+ .showAddressScreen ();
790+ }
781791 }
782792
783793 private class ExpiryWatcher implements TextWatcher {
0 commit comments