Index: trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 4613)
+++ trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 4614)
@@ -890,4 +890,5 @@
 
                 valueCopy = new ArrayList<String>(value);
+                if (valueCopy.contains(null)) throw new RuntimeException("Error: Null as list element in preference setting (key '"+key+"')");
                 collectionProperties.put(key, Collections.unmodifiableList(valueCopy));
                 try {
@@ -1000,6 +1001,9 @@
 
                 valueCopy = new ArrayList<List<String>>(value.size());
+                if (valueCopy.contains(null)) throw new RuntimeException("Error: Null as list element in preference setting (key '"+key+"')");
                 for (Collection<String> lst : value) {
-                    valueCopy.add(Collections.unmodifiableList(new ArrayList<String>(lst)));
+                    List<String> lstCopy = new ArrayList<String>(lst);
+                    if (lstCopy.contains(null)) throw new RuntimeException("Error: Null as inner list element in preference setting (key '"+key+"')");
+                    valueCopy.add(Collections.unmodifiableList(lstCopy));
                 }
                 arrayProperties.put(key, Collections.unmodifiableList(valueCopy));
@@ -1093,6 +1097,10 @@
 
                 valueCopy = new ArrayList<Map<String, String>>(value.size());
+                if (valueCopy.contains(null)) throw new RuntimeException("Error: Null as list element in preference setting (key '"+key+"')");
                 for (Map<String, String> map : value) {
-                    valueCopy.add(Collections.unmodifiableMap(new LinkedHashMap<String,String>(map)));
+                    Map<String, String> mapCopy = new LinkedHashMap<String,String>(map);
+                    if (mapCopy.keySet().contains(null)) throw new RuntimeException("Error: Null as map key in preference setting (key '"+key+"')");
+                    if (mapCopy.values().contains(null)) throw new RuntimeException("Error: Null as map value in preference setting (key '"+key+"')");
+                    valueCopy.add(Collections.unmodifiableMap(mapCopy));
                 }
                 listOfStructsProperties.put(key, Collections.unmodifiableList(valueCopy));
