Index: trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java	(revision 18380)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java	(revision 18388)
@@ -140,12 +140,15 @@
         if (img == null)
             getImage(); // fix #7498 ?
-        Image disImg = GuiHelper.getDisabledImage(img);
-        if (disImg instanceof BufferedImage) {
-            disabledImgCache = (BufferedImage) disImg;
-        } else {
-            disabledImgCache = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
-            Graphics g = disabledImgCache.getGraphics();
-            g.drawImage(disImg, 0, 0, null);
-            g.dispose();
+        // This should fix #21919: NPE due to disabledImgCache being null (race condition with #loadImage())
+        synchronized (this) {
+            Image disImg = GuiHelper.getDisabledImage(img);
+            if (disImg instanceof BufferedImage) {
+                disabledImgCache = (BufferedImage) disImg;
+            } else {
+                disabledImgCache = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
+                Graphics g = disabledImgCache.getGraphics();
+                g.drawImage(disImg, 0, 0, null);
+                g.dispose();
+            }
         }
         return disabledImgCache;
