Index: /trunk/src/org/openstreetmap/josm/command/SelectCommand.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/command/SelectCommand.java	(revision 15323)
+++ /trunk/src/org/openstreetmap/josm/command/SelectCommand.java	(revision 15324)
@@ -35,4 +35,6 @@
         if (newSelection == null || newSelection.isEmpty()) {
             this.newSelection = Collections.emptySet();
+        } else if (newSelection.contains(null)) {
+            throw new IllegalArgumentException("null primitive in selection");
         } else {
             this.newSelection = new HashSet<>(newSelection);
Index: /trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java	(revision 15323)
+++ /trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java	(revision 15324)
@@ -161,3 +161,11 @@
             .verify();
     }
+
+    /**
+     * Unit test of {@link SelectCommand#SelectCommand}.
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testConstructorIAE() {
+        new SelectCommand(new DataSet(), Arrays.asList(new OsmPrimitive[] {null}));
+    }
 }
