Changeset 18496 in josm for trunk/src/org


Ignore:
Timestamp:
2022-06-21T18:31:54+02:00 (3 years ago)
Author:
taylor.smock
Message:

Fix #22156: ArithmeticException: / by zero in org.openstreetmap.josm.data.osm.search.SearchCompiler$Nth.match

This was caused by nth%: 0, as x % 0 will throw a divide by 0
exception.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java

    r18494 r18496  
    12901290        }
    12911291
    1292         private Nth(int nth, boolean modulo) {
     1292        private Nth(int nth, boolean modulo) throws SearchParseError {
    12931293            this.nth = nth;
    12941294            this.modulo = modulo;
     1295            if (this.modulo && this.nth == 0) {
     1296                throw new SearchParseError(tr("Non-zero integer expected"));
     1297            }
    12951298        }
    12961299
Note: See TracChangeset for help on using the changeset viewer.