Index: src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java	(revision 15101)
+++ src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java	(working copy)
@@ -96,6 +96,7 @@
 import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.PlatformManager;
 import org.openstreetmap.josm.tools.Shortcut;
+import org.openstreetmap.josm.tools.SubclassFilteredCollection;
 import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -264,7 +265,7 @@
     */
     public void editTag(final int row, boolean focusOnKey) {
         changedKey = null;
-        sel = OsmDataManager.getInstance().getInProgressSelection();
+        sel = checkForBadPrimitives(OsmDataManager.getInstance().getInProgressSelection());
         if (sel == null || sel.isEmpty())
             return;
 
@@ -279,6 +280,21 @@
     }
 
     /**
+     * Ensure that all OsmPrimitives in sel can be used elsewhere
+     * @param <T> Some class T that extends {@link OsmPrimitive}
+     * @param sel The collection of objects that may have bad primitives
+     * @return A collection of objects without null objects, deleted objects, and objects without DataSets.
+     */
+    private static <T extends OsmPrimitive> Collection<T> checkForBadPrimitives(Collection<T> sel) {
+        // !p.isDeleted duplicates what OsmDataManager.getInstance().getInProgressSelection() does
+        if (sel != null) {
+            return new SubclassFilteredCollection<>(sel, p -> p != null && !p.isDeleted() && p.getDataSet() != null);
+        } else {
+            return Collections.emptyList();
+        }
+    }
+
+    /**
      * Extracted interface of {@link EditTagDialog}.
      */
     protected interface IEditTagDialog extends IExtendedDialog {
