Commit 24886ff7ed5ca53565ed593f84f61e30de981ab4

Thomas de Grivel 2018-06-18T10:26:13

parser-token

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/parser.lisp b/parser.lisp
index 538934a..324c6cf 100644
--- a/parser.lisp
+++ b/parser.lisp
@@ -56,7 +56,10 @@
 
 (defmethod parser-token ((pr parser) (index integer))
   (declare (type fixnum index))
-  (aref (the (vector token) (parser-buffer pr)) index))
+  (let ((buf (parser-buffer pr)))
+    (declare (type (vector token) buf))
+    (when (< index (fill-pointer buf))
+      (aref buf index))))
 
 (defmethod parser-input ((pr parser))
   (let ((in (stream-underlying-stream pr)))