From abeb283fd9971834c47f1578629bc9ec09e941e2 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Jun 2014 15:10:56 +0300 Subject: [PATCH] fixed null reference on selecting same stage. fixed null reference when rotating phone during change stage opration --- .../net/osmand/plus/sherpafy/TourViewActivity.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/TourViewActivity.java b/OsmAnd/src/net/osmand/plus/sherpafy/TourViewActivity.java index ac59e22753..3c3daba523 100644 --- a/OsmAnd/src/net/osmand/plus/sherpafy/TourViewActivity.java +++ b/OsmAnd/src/net/osmand/plus/sherpafy/TourViewActivity.java @@ -436,12 +436,23 @@ public class TourViewActivity extends SherlockFragmentActivity { @Override protected Void doInBackground(TourInformation... params) { + //if tour is already selected - do nothing + if (customization.getSelectedTour()!= null){ + if (customization.getSelectedTour().equals(params[0])){ + return null; + } + } customization.selectTour(params[0], IProgress.EMPTY_PROGRESS); return null; } protected void onPostExecute(Void result) { - dlg.dismiss(); + //to avoid illegal argument exception when rotating phone during loading + try { + dlg.dismiss(); + } catch (Exception ex){ + + } startTourView(); }; }.execute(tour);