Index: trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java	(revision 18495)
+++ trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java	(revision 18496)
@@ -1290,7 +1290,10 @@
         }
 
-        private Nth(int nth, boolean modulo) {
+        private Nth(int nth, boolean modulo) throws SearchParseError {
             this.nth = nth;
             this.modulo = modulo;
+            if (this.modulo && this.nth == 0) {
+                throw new SearchParseError(tr("Non-zero integer expected"));
+            }
         }
 
