Index: trunk/tools/javacc/templates/ParseException.template
===================================================================
--- trunk/tools/javacc/templates/ParseException.template	(revision 16907)
+++ trunk/tools/javacc/templates/ParseException.template	(revision 16908)
@@ -120,5 +120,7 @@
     }
 #if KEEP_LINE_COLUMN
-    retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+    if (currentToken.next != null) {
+      retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+    }
 #fi
     retval += "." + EOL;
