diff --git a/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/presenter/NaviPresenter.java b/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/presenter/NaviPresenter.java index 3eefaf7863..a5b5053315 100644 --- a/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/presenter/NaviPresenter.java +++ b/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/presenter/NaviPresenter.java @@ -43,6 +43,7 @@ public class NaviPresenter extends Presenter implements @Override public void onDestroy( @NonNull LifecycleOwner owner ) { + releaseListeners(); super.onDestroy( owner ); } @@ -54,24 +55,22 @@ public class NaviPresenter extends Presenter implements TaxiModel.getInstance().setMoGoAutopilotPlanningListener(null); } - private void runOnUIThread( Runnable executor ) { - if ( executor == null ) { - return; - } - if ( Looper.myLooper() != Looper.getMainLooper() ) { - UiThreadHandler.post( executor ); - } else { - executor.run(); - } - } - @Override public void setLineMarker(LatLng startStation, LatLng endStation) { - runOnUIThread(() -> mView.setLineMarker(startStation,endStation)); + UiThreadHandler.post(new Runnable() { + @Override + public void run() { + if(mView!=null) { + mView.setLineMarker(startStation, endStation); + } + } + },UiThreadHandler.MODE.QUEUE); } @Override public void routeResult(List routeArrivied, List routeArriving, MogoLocation location) { - mView.routeResult(routeArrivied,routeArriving,location); + if(mView!=null) { + mView.routeResult(routeArrivied, routeArriving, location); + } } }