Index: /trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java	(revision 18616)
+++ /trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java	(revision 18617)
@@ -624,5 +624,6 @@
         }
         // Defensive copy of keys
-        String[] newKeys = keys;
+        final String[] tKeys = this.keys; // Used to avoid highly unlikely NPE (from a race) during clone operation.
+        String[] newKeys = tKeys == null ? null : tKeys.clone();
         Map<String, String> originalKeys = getKeys();
         List<Map.Entry<String, String>> tagsToAdd = new ArrayList<>(tags.size());
@@ -630,5 +631,5 @@
             if (!Utils.isBlank(tag.getKey())) {
                 int keyIndex = indexOfKey(newKeys, tag.getKey());
-                // Realistically, we will not hit the newKeys == null branch. If it is null, keyIndex is always < 1
+                // Realistically, we will not hit the newKeys == null branch. If it is null, keyIndex is always < 0
                 if (keyIndex < 0 || newKeys == null) {
                     tagsToAdd.add(tag);
