From 836620c440a9d42e037aed3216ad19f1c071f2e5 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sun, 5 Mar 2017 11:27:45 +0300 Subject: [PATCH] Fix #3531 --- OsmAnd/src/net/osmand/plus/views/GPXLayer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); }