Skip to content

Commit

Permalink
Fix crash in logout
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvavra committed Mar 2, 2022
1 parent b726bb4 commit f65ada7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions library/src/main/java/com/okta/oidc/OktaResultFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import androidx.annotation.RestrictTo;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;

import com.okta.oidc.net.request.web.WebRequest;

Expand Down Expand Up @@ -58,10 +59,12 @@ public static void addLogoutFragment(WebRequest request,
OktaResultFragment fragment = new OktaResultFragment();
fragment.logoutIntent = createAuthIntent(activity, request.toUri(), customTabOptions,
browsers);
activity.getSupportFragmentManager()
.beginTransaction()
.add(fragment, AUTHENTICATION_REQUEST)
.commit();
FragmentManager fragmentManager = activity.getSupportFragmentManager();
if (!fragmentManager.isDestroyed()) {
fragmentManager.beginTransaction()
.add(fragment, AUTHENTICATION_REQUEST)
.commit();
}
}

@Override
Expand Down

0 comments on commit f65ada7

Please sign in to comment.