Index: trunk/src/org/openstreetmap/josm/tools/ColorHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ColorHelper.java	(revision 9228)
+++ trunk/src/org/openstreetmap/josm/tools/ColorHelper.java	(revision 9229)
@@ -82,6 +82,7 @@
     public static Color getForegroundColor(Color bg) {
         // http://stackoverflow.com/a/3943023/2257172
-        return (bg.getRed()*0.299 + bg.getGreen()*0.587 + bg.getBlue()*0.114) > 186 ?
-                Color.BLACK : Color.WHITE;
+        return bg == null ? null :
+              (bg.getRed()*0.299 + bg.getGreen()*0.587 + bg.getBlue()*0.114) > 186 ?
+                  Color.BLACK : Color.WHITE;
     }
 }
