Index: trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 6847)
+++ trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 6848)
@@ -830,8 +830,11 @@
 
         public Nth(PushbackTokenizer tokenizer, boolean modulo) throws ParseError {
-            this((int) tokenizer.readNumber(tr("Primitive id expected")), modulo);
-        }
-
-        private Nth(int nth, boolean modulo) {
+            this((int) tokenizer.readNumber(tr("Positive integer expected")), modulo);
+        }
+
+        private Nth(int nth, boolean modulo) throws ParseError {
+            if (nth <= 0) {
+                throw new ParseError(tr("Positive integer expected"));
+            }
             this.nth = nth;
             this.modulo = modulo;
