Ignore:
Timestamp:
2023-05-16T16:16:14+02:00 (21 months ago)
Author:
taylor.smock
Message:

Fix #22946: NullPointerException in DrawnPolyLine#autoSimplify

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FastDraw/test/unit/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLineTest.java

    r36059 r36082  
    7272        assertDoesNotThrow(() -> this.drawnPolyLine.getLastPoint());
    7373    }
     74
     75    /**
     76     * Non-regression test for #22946: NullPointerException in {@link DrawnPolyLine#autoSimplify(double, double, int, double)}
     77     * The root issue is probably from some kind of race condition.
     78     */
     79    @Test
     80    void testNonRegression22946() {
     81        this.drawnPolyLine.addLast(new LatLon(0.00001, 0.00001));
     82        this.drawnPolyLine.addLast(new LatLon(0.00002, 0.00002));
     83        this.drawnPolyLine.addLast(new LatLon(0.00002, 0.00003));
     84        this.drawnPolyLine.clear();
     85        // The maxPKM == -.1 to force the bad code path. As noted, it is probably a race condition issue.
     86        assertDoesNotThrow(() -> this.drawnPolyLine.autoSimplify(5, 1.1, 10, -.1));
     87    }
    7488}
Note: See TracChangeset for help on using the changeset viewer.