From d46b097bc8233bec1431479dc1c99f2be325cb62 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 4 Oct 2014 09:28:29 -0500 Subject: [PATCH] fix syntax error check in 'bitmap' closes PR 14763 --- .../htdp-lib/2htdp/private/image-more.rkt | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pkgs/htdp-pkgs/htdp-lib/2htdp/private/image-more.rkt b/pkgs/htdp-pkgs/htdp-lib/2htdp/private/image-more.rkt index 0342369272..58b382a850 100644 --- a/pkgs/htdp-pkgs/htdp-lib/2htdp/private/image-more.rkt +++ b/pkgs/htdp-pkgs/htdp-lib/2htdp/private/image-more.rkt @@ -1356,23 +1356,23 @@ (eq? (car arg) 'planet)) (raise-syntax-error 'bitmap "planet paths not yet supported" stx)] [(symbol? arg) - (let ([pieces (regexp-split #rx"/" (symbol->string arg))]) - (cond - [(null? pieces) - (raise-syntax-error 'bitmap "expected a path with a / in it" stx)] - [else - (define fn (last pieces)) - (define colls (reverse (cdr (reverse pieces)))) - (define candidate - (apply collection-file-path fn colls - #:fail - (λ (msg) (raise-syntax-error 'bitmap msg stx)))) - (unless (file-exists? candidate) - (raise-syntax-error 'bitmap - (format "could not find ~s, expected it to be in ~a" - arg candidate) - stx)) - (cons fn colls)]))] + (define pieces (regexp-split #rx"/" (symbol->string arg))) + (cond + [(or (null? pieces) (null? (cdr pieces))) + (raise-syntax-error 'bitmap "expected a path with a / in it" stx)] + [else + (define fn (last pieces)) + (define colls (reverse (cdr (reverse pieces)))) + (define candidate + (apply collection-file-path fn colls + #:fail + (λ (msg) (raise-syntax-error 'bitmap msg stx)))) + (unless (file-exists? candidate) + (raise-syntax-error 'bitmap + (format "could not find ~s, expected it to be in ~a" + arg candidate) + stx)) + (cons fn colls)])] [(string? arg) (path->complete-path arg