File tree 1 file changed +11
-7
lines changed
fragmentation_core/src/main/java/me/yokeyword/fragmentation
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -247,19 +247,23 @@ void pop(final FragmentManager fm) {
247
247
@ Override
248
248
public void run () {
249
249
handleAfterSaveInStateTransactionException (fm , "pop()" );
250
- removeTopFragment (fm );
251
250
FragmentationMagician .popBackStackAllowingStateLoss (fm );
251
+ removeTopFragment (fm );
252
252
}
253
253
});
254
254
}
255
255
256
256
private void removeTopFragment (FragmentManager fm ) {
257
- ISupportFragment top = SupportHelper .getBackStackTopFragment (fm );
258
- if (top != null ) {
259
- fm .beginTransaction ()
260
- .setTransition (FragmentTransaction .TRANSIT_FRAGMENT_CLOSE )
261
- .remove ((Fragment ) top )
262
- .commitAllowingStateLoss ();
257
+ try { // Safe popBackStack()
258
+ ISupportFragment top = SupportHelper .getBackStackTopFragment (fm );
259
+ if (top != null ) {
260
+ fm .beginTransaction ()
261
+ .setTransition (FragmentTransaction .TRANSIT_FRAGMENT_CLOSE )
262
+ .remove ((Fragment ) top )
263
+ .commitAllowingStateLoss ();
264
+ }
265
+ } catch (Exception ignored ) {
266
+
263
267
}
264
268
}
265
269
You can’t perform that action at this time.
0 commit comments