diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index b726789b34..89de21e97e 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -368,10 +368,13 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex List selectedGPXFiles, DrawSettings settings) { for (SelectedGpxFile g : selectedGPXFiles) { - GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path)); + GpxDataItem gpxDataItem = null; + if (!g.isShowCurrentTrack()) { + gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path)); + } List segments = g.getPointsToDisplay(); for (TrkSegment ts : segments) { - int color = gpxDataItem.getColor(); + int color = gpxDataItem != null ? gpxDataItem.getColor() : 0; if (color == 0) { color = ts.getColor(cachedColor); }