From 9964e289696b6fe5cda3d7bad8a1387a0c506208 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Tue, 11 Jan 2011 08:06:26 -0600 Subject: [PATCH] added a check in bitmap to make the file argument exists --- collects/2htdp/private/image-more.rkt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/collects/2htdp/private/image-more.rkt b/collects/2htdp/private/image-more.rkt index 313115720e..ff8fa60f0d 100644 --- a/collects/2htdp/private/image-more.rkt +++ b/collects/2htdp/private/image-more.rkt @@ -1264,8 +1264,14 @@ arg (or (current-load-relative-directory) (current-directory)))])]) - ;; the rotate does a coercion to a 2htdp/image image - #`(rotate 0 (make-object image-snip% (make-object bitmap% #,path 'unknown/mask))))])) + #`(bitmap/proc #,path))])) + +(define (bitmap/proc arg) + (when (and (path? arg) + (not (file-exists? arg))) + (error 'bitmap "could not find the file ~a" (path->string arg))) + ;; the rotate does a coercion to a 2htdp/image image + (rotate 0 (make-object image-snip% (make-object bitmap% arg 'unknown/mask)))) (define/chk (image->color-list image) (let* ([w (image-width image)]