Index: trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 11490)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java	(revision 11493)
@@ -463,4 +463,13 @@
 
     /**
+     * remove a style source; only accessed from MapPaintStyles
+     * @param style style source to remove
+     * @return {@code true} if this list contained the specified element
+     */
+    boolean remove(StyleSource style) {
+        return styleSources.remove(style);
+    }
+
+    /**
      * set the style sources; only accessed from MapPaintStyles
      * @param sources new style sources
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 11490)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 11493)
@@ -290,4 +290,7 @@
 
     private static StyleSource fromSourceEntry(SourceEntry entry) {
+        if (entry.url == null && entry instanceof MapCSSStyleSource) {
+            return (MapCSSStyleSource) entry;
+        }
         Set<String> mimes = new HashSet<>(Arrays.asList(MapCSSStyleSource.MAPCSS_STYLE_MIME_TYPES.split(", ")));
         try (CachedFile cf = new CachedFile(entry.url).setHttpAccept(Utils.join(", ", mimes))) {
@@ -419,4 +422,21 @@
         styles.add(source);
         loadStyleForFirstTime(source);
+        refreshStyles();
+        return source;
+    }
+
+    /**
+     * Remove a map paint style.
+     * @param entry map paint style
+     * @since 11493
+     */
+    public static void removeStyle(SourceEntry entry) {
+        StyleSource source = fromSourceEntry(entry);
+        if (styles.remove(source)) {
+            refreshStyles();
+        }
+    }
+
+    private static void refreshStyles() {
         MapPaintPrefHelper.INSTANCE.put(styles.getStyleSources());
         fireMapPaintSylesUpdated();
@@ -425,5 +445,4 @@
             Main.map.mapView.repaint();
         }
-        return source;
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java	(revision 11490)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java	(revision 11493)
@@ -272,5 +272,5 @@
         public Map<String, String> serialize(SourceEntry entry) {
             Map<String, String> res = new HashMap<>();
-            res.put("url", entry.url);
+            res.put("url", entry.url == null ? "" : entry.url);
             res.put("title", entry.title == null ? "" : entry.title);
             res.put("active", Boolean.toString(entry.active));
Index: trunk/src/org/openstreetmap/josm/io/CachedFile.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 11490)
+++ trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 11493)
@@ -207,5 +207,5 @@
         File file = getFile();
         if (file == null) {
-            if (name.startsWith("resource://")) {
+            if (name != null && name.startsWith("resource://")) {
                 InputStream is = getClass().getResourceAsStream(
                         name.substring("resource:/".length()));
@@ -273,5 +273,5 @@
             }
         } catch (MalformedURLException e) {
-            if (name.startsWith("resource://")) {
+            if (name == null || name.startsWith("resource://")) {
                 return null;
             } else if (name.startsWith("josmdir://")) {
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 11490)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 11493)
@@ -1166,5 +1166,5 @@
      */
     public static boolean isLocalUrl(String url) {
-        if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("resource://"))
+        if (url == null || url.startsWith("http://") || url.startsWith("https://") || url.startsWith("resource://"))
             return false;
         return true;
