From 0823f47ee176f7b6f8241cdb794fff3b3a01fdca Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 25 Jan 2018 21:09:54 +0200 Subject: [PATCH] Fix class casting exception --- OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java | 8 ++++++-- .../src/net/osmand/plus/helpers/WaypointDialogHelper.java | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java index 3dbe7cbe91..c005c66ac5 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java @@ -247,7 +247,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis Object obj = listAdapter.getItem(position); if (obj instanceof LocationPointWrapper) { LocationPointWrapper w = (LocationPointWrapper) obj; - return !((TargetPoint) w.getPoint()).start; + if (w.getPoint() instanceof TargetPoint) { + return !((TargetPoint) w.getPoint()).start; + } } return activeObjects.contains(obj); } @@ -332,7 +334,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis Object item = items.get(0); if (item instanceof LocationPointWrapper) { LocationPointWrapper w = (LocationPointWrapper) item; - return ((TargetPoint) w.getPoint()).start; + if (w.getPoint() instanceof TargetPoint) { + return ((TargetPoint) w.getPoint()).start; + } } } return false; diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java index 82b3283020..6a722fc9f0 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java @@ -388,7 +388,7 @@ public class WaypointDialogHelper { move.setVisibility(View.GONE); } else { boolean notFlatTargets = point.type == WaypointHelper.TARGETS && !flat; - boolean startPoint = ((TargetPoint) point.point).start; + boolean startPoint = notFlatTargets && ((TargetPoint) point.point).start; final TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper(); boolean canRemove = !targetPointsHelper.getIntermediatePoints().isEmpty(); @@ -627,7 +627,9 @@ public class WaypointDialogHelper { Object item = items.get(0); if (item instanceof LocationPointWrapper) { LocationPointWrapper w = (LocationPointWrapper) item; - hasActivePoints = !((TargetPoint) w.point).start; + if (w.getPoint() instanceof TargetPoint) { + hasActivePoints = !((TargetPoint) w.point).start; + } } else { hasActivePoints = true; }