1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

SRFI-37: Account for zero-length arguments.

* module/srfi/srfi-37.scm (args-fold): When checking if an argument is
an option (starts with #\-), first check if the length is non-zero.
This commit is contained in:
Thomas Danckaert 2017-04-19 18:14:38 +02:00 committed by Andy Wingo
parent 40df57a8a2
commit 02cf38514d

View file

@ -217,7 +217,8 @@ program-arguments in ARGS, as decided by the OPTIONS'
(if (null? args) (if (null? args)
(apply values seeds) (apply values seeds)
(let ((arg (car args))) (let ((arg (car args)))
(cond ((or (not (char=? #\- (string-ref arg 0))) (cond ((or (string-null? arg)
(not (char=? #\- (string-ref arg 0)))
(= 1 (string-length arg))) ;"-" (= 1 (string-length arg))) ;"-"
(mutate-seeds! operand-proc arg) (mutate-seeds! operand-proc arg)
(set! args (cdr args))) (set! args (cdr args)))