Skip to content

Commit

Permalink
prevented flight mode panel update when the view is no longer active.
Browse files Browse the repository at this point in the history
  • Loading branch information
m4gr3d committed Mar 5, 2015
1 parent 653f898 commit 563264d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class FlightModePanel extends ApiListenerFragment{
private final BroadcastReceiver eventReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if(getActivity() == null)
return;

onModeUpdate(getDrone());
}
};
Expand Down Expand Up @@ -142,7 +145,6 @@ private void onModeUpdate(Drone drone) {
}
}

getChildFragmentManager().beginTransaction().replace(R.id.modeInfoPanel, infoPanel)
.commit();
getChildFragmentManager().beginTransaction().replace(R.id.modeInfoPanel, infoPanel).commit();
}
}

0 comments on commit 563264d

Please sign in to comment.