Index: /trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java	(revision 7339)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java	(revision 7340)
@@ -3,6 +3,6 @@
 package org.openstreetmap.josm.gui.layer.gpx;
 
+import static org.openstreetmap.josm.tools.I18n.marktr;
 import static org.openstreetmap.josm.tools.I18n.tr;
-import static org.openstreetmap.josm.tools.I18n.marktr;
 
 import java.awt.BasicStroke;
@@ -15,4 +15,5 @@
 import java.util.Date;
 import java.util.List;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -24,10 +25,10 @@
 
 /**
- * Class that helps to draw large set of GPS tracks with different colors and options 
+ * Class that helps to draw large set of GPS tracks with different colors and options
  * @since 7319
  */
 public class GpxDrawHelper {
     private GpxData data;
-    
+
     // draw lines between points belonging to different segments
     private boolean forceLines;
@@ -51,5 +52,5 @@
 
     private static final double PHI = Math.toRadians(15);
-    
+
     //// Variables used only to check cache validity
     private boolean computeCacheInSync = false;
@@ -62,5 +63,5 @@
     //// Color-related fields
     /** Mode of the line coloring **/
-    private ColorMode colored; 
+    private ColorMode colored;
     /** max speed for coloring - allows to tweak line coloring for different speed levels. **/
     private int colorTracksTune;
@@ -75,8 +76,8 @@
     ColorScale dateScale;
     ColorScale directionScale;
-    
+
     /** Opacity for hdop points **/
     private int hdopAlpha;
-    
+
 
     // lookup array to draw arrows without doing any math
@@ -88,5 +89,5 @@
         { +ll0, -sl4, +sl4, -ll0 }, { +ll0, +sl9, +ll0, -sl9 }, { +sl4, +ll0, +ll0, +sl4 },
         { -sl9, +ll0, +sl9, +ll0 }, { -ll0, +sl4, -sl4, +ll0 }, { -ll0, -sl9, -ll0, +sl9 } };
-    
+
     private void setupColors() {
         hdopAlpha = Main.pref.getInteger("hdop.color.alpha", -1);
@@ -104,15 +105,15 @@
         NONE, VELOCITY, HDOP, DIRECTION, TIME
     }
-    
+
     public GpxDrawHelper(GpxData gpxData) {
         data = gpxData;
         setupColors();
     }
-   
+
     /**
-     * Get the default color for gps tracks for specified layer 
+     * Get the default color for gps tracks for specified layer
      * @param layerName name of the GpxLayer
      * @param ignoreCustom do not use preferences
-     * @return the color or null if the color is not constant 
+     * @return the color or null if the color is not constant
      */
     public Color getColor(String layerName, boolean ignoreCustom) {
@@ -142,5 +143,5 @@
         return Main.pref.getColor(marktr("gps point"), Color.gray);
     }
-    
+
     /**
      * Read all drawing-related settings from preferences
@@ -177,13 +178,13 @@
         hdopScale.setNoDataColor(neutralColor);
         directionScale.setNoDataColor(neutralColor);
-        
+
         largesize += lineWidth;
     }
-    
-    
+
+
     public void drawAll(Graphics2D g, MapView mv, List<WayPoint> visibleSegments) {
 
         checkCache();
-        
+
         // STEP 2b - RE-COMPUTE CACHE DATA *********************
         if (!computeCacheInSync) { // don't compute if the cache is good
@@ -192,9 +193,9 @@
 
         Stroke storedStroke = g.getStroke();
-        
+
         g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
             Main.pref.getBoolean("mappaint.gpx.use-antialiasing", false) ?
                     RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
-        
+
         if(lineWidth != 0) {
            g.setStroke(new BasicStroke(lineWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
@@ -207,10 +208,10 @@
         }
     }
-    
+
     public void calculateColors() {
         double minval = +1e10;
         double maxval = -1e10;
         WayPoint oldWp = null;
-        
+
         if (colorModeDynamic) {
             if (colored == ColorMode.VELOCITY) {
@@ -280,5 +281,5 @@
         }
 
-        
+
         // Now the colors for all the points will be assigned
         for (Collection<WayPoint> segment : data.getLinesIterable(null)) {
@@ -293,6 +294,6 @@
                 }
                  // now we are sure some color will be assigned
-                Color color = null; 
-            
+                Color color = null;
+
                 if (colored == ColorMode.HDOP) {
                     Float hdop = ((Float) trkPnt.attr.get("hdop"));
@@ -329,5 +330,5 @@
                     } else {
                         trkPnt.drawLine = false;
-                    } 
+                    }
                 } else { // make sure we reset outdated data
                     trkPnt.drawLine = false;
@@ -340,10 +341,10 @@
             }
         }
-        
+
         computeCacheInSync = true;
     }
 
 
-  
+
     private void drawLines(Graphics2D g, MapView mv, List<WayPoint> visibleSegments) {
         if (lines) {
@@ -396,6 +397,6 @@
                 }
             } // end for trkpnt
-        } 
-        
+        }
+
         /****************************************************************
          ********** STEP 3c - DRAW FAST ARROWS **************************
@@ -425,5 +426,5 @@
                 }
             } // end for trkpnt
-        } 
+        }
     }
 
@@ -440,6 +441,6 @@
                 }
                 Point screen = mv.getPoint(trkPnt.getEastNorth());
-                
-                    
+
+
                 if (hdopCircle && trkPnt.attr.get("hdop") != null) {
                     // hdop value
@@ -457,8 +458,10 @@
                 if (large) {
                     // color the large GPS points like the gps lines
-                    Color customColoringTransparent = largePointAlpha<0 ? trkPnt.customColoring: 
-                        new Color(trkPnt.customColoring.getRGB() & 0x00ffffff | largePointAlpha<<24, true);
-                    
-                    g.setColor(customColoringTransparent);
+                    if (trkPnt.customColoring != null) {
+                        Color customColoringTransparent = largePointAlpha<0 ? trkPnt.customColoring:
+                            new Color(trkPnt.customColoring.getRGB() & 0x00ffffff | largePointAlpha<<24, true);
+
+                        g.setColor(customColoringTransparent);
+                    }
                     g.fillRect(screen.x-halfSize, screen.y-halfSize, largesize, largesize);
                 }
@@ -519,5 +522,5 @@
         computeCacheInSync = false;
     }
-    
+
     public void drawColorBar(Graphics2D g, MapView mv) {
         int w = mv.getWidth();
@@ -531,4 +534,4 @@
         }
     }
-    
+
 }
