summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/array-list.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/chickadee/array-list.scm b/chickadee/array-list.scm
index dad0b8d..54a11e8 100644
--- a/chickadee/array-list.scm
+++ b/chickadee/array-list.scm
@@ -76,7 +76,9 @@
(set-array-list-vector! array-list new-vec)))
(define (array-list-ref array-list i)
- (vector-ref (array-list-vector array-list) i))
+ (if (and (>= i 0) (< i (array-list-size array-list)))
+ (vector-ref (array-list-vector array-list) i)
+ (error "array list index out of bounds" i)))
(define (array-list-set! array-list i x)
(vector-set! (array-list-vector array-list) i x))