Index: applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java
===================================================================
--- applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java	(revision 36081)
+++ applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java	(revision 36082)
@@ -157,5 +157,7 @@
             e = e * ekf;
             simplify(e);
-            Logging.trace("DrawnPolyLine: eps={0} n={1}", e, simplePoints.size());
+            if (simplePoints != null) {
+                Logging.trace("DrawnPolyLine: eps={0} n={1}", e, simplePoints.size());
+            }
         }
         return e;
Index: applications/editors/josm/plugins/FastDraw/test/unit/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLineTest.java
===================================================================
--- applications/editors/josm/plugins/FastDraw/test/unit/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLineTest.java	(revision 36081)
+++ applications/editors/josm/plugins/FastDraw/test/unit/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLineTest.java	(revision 36082)
@@ -72,3 +72,17 @@
         assertDoesNotThrow(() -> this.drawnPolyLine.getLastPoint());
     }
+
+    /**
+     * Non-regression test for #22946: NullPointerException in {@link DrawnPolyLine#autoSimplify(double, double, int, double)}
+     * The root issue is probably from some kind of race condition.
+     */
+    @Test
+    void testNonRegression22946() {
+        this.drawnPolyLine.addLast(new LatLon(0.00001, 0.00001));
+        this.drawnPolyLine.addLast(new LatLon(0.00002, 0.00002));
+        this.drawnPolyLine.addLast(new LatLon(0.00002, 0.00003));
+        this.drawnPolyLine.clear();
+        // The maxPKM == -.1 to force the bad code path. As noted, it is probably a race condition issue.
+        assertDoesNotThrow(() -> this.drawnPolyLine.autoSimplify(5, 1.1, 10, -.1));
+    }
 }
