From 754b3457c31efea48745cb761c356ca1a1187988 Mon Sep 17 00:00:00 2001 From: Brian Adkins Date: Tue, 23 Mar 2021 12:39:15 -0400 Subject: [PATCH] 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. --- racket/collects/racket/string.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/racket/collects/racket/string.rkt b/racket/collects/racket/string.rkt index c22fe11bc5..551ca54e2b 100644 --- a/racket/collects/racket/string.rkt +++ b/racket/collects/racket/string.rkt @@ -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? +?)))