Verify the argument is a string?

For the fast path of splitting on whitespace, verify the str
argument is a string, so that internal-split will handle the
invalid argument error.
This commit is contained in:
Brian Adkins 2021-03-23 12:39:15 -04:00 committed by Matthew Flatt
parent d061df81ce
commit 754b3457c3

View File

@ -148,7 +148,7 @@
[else (loop beg (add1 end))])))
(define (string-split str [sep none] #:trim? [trim? #t] #:repeat? [+? #f])
(if (and (eq? sep none) trim?)
(if (and (string? str) (eq? sep none) trim?)
(internal-split-whitespace str)
(internal-split 'string-split str sep trim? +?)))