Skip to content

Commit

Permalink
Fix speed alarm
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanPyrohivskyi committed Feb 6, 2025
1 parent 051d578 commit 57c4b0c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.enums.DrivingRegion;
import net.osmand.router.RouteSegmentResult;
import net.osmand.shared.settings.enums.SpeedConstants;
import net.osmand.plus.settings.enums.WidgetSize;
import net.osmand.plus.utils.AndroidUtils;
Expand Down Expand Up @@ -614,7 +615,13 @@ private AlarmInfo getSpeedLimitInfo() {
AlarmInfo alarm = waypointHelper.getSpeedLimitAlarm(speedFormat, whenExceeded);
if (alarm == null) {
Location loc = provider.getLastKnownLocation();
RouteDataObject dataObject = provider.getLastKnownRouteSegment();
RouteSegmentResult current = routingHelper.getRoute().getCurrentSegmentResult();
RouteDataObject dataObject = null;
if (current != null) {
dataObject = current.getObject();
} else {
dataObject = provider.getLastKnownRouteSegment();
}
if (dataObject != null && loc != null) {
alarm = waypointHelper.calculateSpeedLimitAlarm(dataObject, loc, speedFormat, whenExceeded);
}
Expand Down

0 comments on commit 57c4b0c

Please sign in to comment.