Index: trunk/src/org/openstreetmap/josm/data/projection/Projections.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/projection/Projections.java	(revision 18029)
+++ trunk/src/org/openstreetmap/josm/data/projection/Projections.java	(revision 18030)
@@ -362,5 +362,5 @@
      */
     public static Projection getProjectionByCode(String code) {
-        return projectionsByCodeCache.computeIfAbsent(code, Projections::computeProjectionByCode);
+        return code != null ? projectionsByCodeCache.computeIfAbsent(code, Projections::computeProjectionByCode) : null;
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionsTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionsTest.java	(revision 18030)
+++ trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionsTest.java	(revision 18030)
@@ -0,0 +1,17 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.data.projection;
+
+import static org.junit.Assert.assertNull;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Unit tests of {@link Projections}.
+ */
+class ProjectionsTest {
+
+    @Test
+    void testGetProjectionByCode_nullSafe() {
+        assertNull(Projections.getProjectionByCode(null));
+    }
+}
