commit 9a0351510810bf93a82f9fd9157a8569527795b2 Author: Fabio Mazza Date: Mon Nov 24 10:36:01 2025 +0100 Avoid crashing when list of points is empty diff --git a/app/src/main/java/it/reyboz/bustorino/map/MapLibreUtils.kt b/app/src/main/java/it/reyboz/bustorino/map/MapLibreUtils.kt index 72f7e71..4eba930 100644 --- a/app/src/main/java/it/reyboz/bustorino/map/MapLibreUtils.kt +++ b/app/src/main/java/it/reyboz/bustorino/map/MapLibreUtils.kt @@ -78,15 +78,18 @@ class MapLibreUtils { @JvmStatic fun findPointsToPutDirectionMarkers(polyPoints: List, stops: List, distanceIcon: Double): List{ + //output value + val pointsOutput = mutableListOf() val closestIndices = findIndicesClosestPointsForStops(polyPoints, stops) Log.d(DEBUG_TAG, "idcs: $closestIndices") + if(closestIndices.size==0) + return pointsOutput val distancesSec = mutableListOf() var pi = closestIndices[0] val cumulativeDist = mutableListOf() var sum = 0.0 - val pointsOutput = mutableListOf() var nPoints = 0 var distFromLastPoint = 0.0 for(i in 1..