From 0083b7d0e14b64d4fa908ead656ae2815783b8f3 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 3 Feb 2021 13:40:58 +0200 Subject: [PATCH] Fix possible npe with general router --- .../RouteOptionsBottomSheet.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java index 9916813c5e..8ba86dfe35 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java @@ -625,11 +625,14 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment { private List getReliefParameters() { List reliefFactorParameters = new ArrayList<>(); - Map parameters = app.getRouter(applicationMode).getParameters(); - for (Map.Entry entry : parameters.entrySet()) { - RoutingParameter routingParameter = entry.getValue(); - if (RELIEF_SMOOTHNESS_FACTOR.equals(routingParameter.getGroup())) { - reliefFactorParameters.add(routingParameter); + GeneralRouter router = app.getRouter(applicationMode); + if (router != null) { + Map parameters = router.getParameters(); + for (Map.Entry entry : parameters.entrySet()) { + RoutingParameter routingParameter = entry.getValue(); + if (RELIEF_SMOOTHNESS_FACTOR.equals(routingParameter.getGroup())) { + reliefFactorParameters.add(routingParameter); + } } } return reliefFactorParameters;