Skip to content

Commit 3fe045f

Browse files
author
liang02.wang
committed
修复已知bug
1 parent 0a3e1f3 commit 3fe045f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/main/java/me/liam/support/ExtraTransaction.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ public void start(final SupportFragment to) {
184184
actionQueue.enqueue(new Action() {
185185
@Override
186186
public long run() {
187+
if (from == null || from.getFragmentManager() == null) return 0;
187188
bindFragmentOptions(to,from.getContainerId(),record);
188189
to.setFragmentAnimation(record.fragmentAnimation);
189190
FragmentTransaction ft = from.getFragmentManager().beginTransaction();
@@ -200,6 +201,7 @@ public void startWithPop(final SupportFragment to) {
200201
actionQueue.enqueue(new Action() {
201202
@Override
202203
public long run() {
204+
if (from == null || from.getFragmentManager() == null) return 0;
203205
bindFragmentOptions(to,from.getContainerId(),record);
204206
to.setFragmentAnimation(record.fragmentAnimation);
205207
FragmentTransaction ft = from.getFragmentManager().beginTransaction();
@@ -209,6 +211,7 @@ public long run() {
209211
to.setCallBack(new SupportFragmentCallBack(){
210212
@Override
211213
public void onEnterAnimEnd() {
214+
if (from == null || from.getFragmentManager() == null) return;
212215
FragmentTransaction ft = from.getFragmentManager().beginTransaction();
213216
ft.remove(from);
214217
supportCommit(ft);
@@ -231,6 +234,7 @@ public void startWithPopTo(final SupportFragment to, Class popToCls, boolean inc
231234
actionQueue.enqueue(new Action() {
232235
@Override
233236
public long run() {
237+
if (from == null || from.getFragmentManager() == null) return 0;
234238
bindFragmentOptions(to,from.getContainerId(),record);
235239
to.setFragmentAnimation(record.fragmentAnimation);
236240
FragmentTransaction ft = from.getFragmentManager().beginTransaction();
@@ -260,6 +264,7 @@ public void pop() {
260264
actionQueue.enqueue(new Action() {
261265
@Override
262266
public long run() {
267+
if (from == null || from.getFragmentManager() == null) return 0;
263268
SupportFragment remove = FragmentUtils.getLastFragment(from.getFragmentManager());
264269
if (remove == null) return 0;
265270
long duration = AnimationUtils.loadAnimation(remove.getContext(),remove.getFragmentAnimation().getExitAnimId()).getDuration();
@@ -442,6 +447,7 @@ void setResult(SupportFragment target, int resultCode, Bundle data){
442447
}
443448

444449
void popTo(FragmentManager fm,Class cls,boolean includeTarget,Runnable run){
450+
if (fm == null) return;
445451
SupportFragment remove = FragmentUtils.getLastFragment(fm);
446452
SupportFragment target = FragmentUtils.findFragmentByClass(fm,cls);
447453
if (remove == null || target == null) return;

0 commit comments

Comments
 (0)