From c4cd8e8b7a5b76620d3f39005cd895e622021194 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 11 May 2020 11:08:52 +0200 Subject: [PATCH] Fix NPE --- OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index 62567b4d07..80ec7d0733 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -146,8 +146,8 @@ public class VoiceRouter { public void updateAppMode() { - - if (router.getAppMode().isDerivedRoutingFrom(ApplicationMode.CAR)) { + ApplicationMode appMode = router.getAppMode() == null ? settings.getApplicationMode() : router.getAppMode(); + if (appMode.isDerivedRoutingFrom(ApplicationMode.CAR)) { // could be changed in future as others by default in settings is 45 kmh DEFAULT_SPEED = 14; // ~50 km/h //DEFAULT speed is configurable @@ -157,7 +157,7 @@ public class VoiceRouter { // DEFAULT_SPEED = 1.11f; //4 km/h 2f; // 7,2 km/h } else { // minimal is 1 meter for turn now - DEFAULT_SPEED = (float) Math.max(0.3, router.getAppMode().getDefaultSpeed()); + DEFAULT_SPEED = (float) Math.max(0.3, appMode.getDefaultSpeed()); }