diff --git a/collects/2htdp/tests/test-image.ss b/collects/2htdp/tests/test-image.ss index f18b6e67d2..3554b60c5c 100644 --- a/collects/2htdp/tests/test-image.ss +++ b/collects/2htdp/tests/test-image.ss @@ -972,4 +972,8 @@ #"\0\0\0\0" #"\377\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0" #"\0\0\0\0")) - \ No newline at end of file + +;; ensure no error +(check-equal? (begin (scale 2 (make-object bitmap% 10 10)) + (void)) + (void)) diff --git a/collects/mrlib/image-core.ss b/collects/mrlib/image-core.ss index 875bc9a745..d216c6dfc3 100644 --- a/collects/mrlib/image-core.ss +++ b/collects/mrlib/image-core.ss @@ -629,18 +629,20 @@ the mask bitmap and the original bitmap are all together in a single bytes! [scale-w (ceiling (inexact->exact (* x-scale (send orig-bm get-width))))] [scale-h (ceiling (inexact->exact (* y-scale (send orig-bm get-height))))] [new-bm (make-object bitmap% scale-w scale-h)] - [new-mask (make-object bitmap% scale-w scale-h)]) - (send new-bm set-loaded-mask new-mask) + [new-mask (and orig-mask (make-object bitmap% scale-w scale-h))]) + (when new-mask + (send new-bm set-loaded-mask new-mask)) (send bdc set-bitmap new-bm) (send bdc set-scale x-scale y-scale) (send bdc clear) (send bdc draw-bitmap orig-bm 0 0) - (send bdc set-bitmap new-mask) - (send bdc set-scale x-scale y-scale) - (send bdc clear) - (send bdc draw-bitmap orig-mask 0 0) + (when new-mask + (send bdc set-bitmap new-mask) + (send bdc set-scale x-scale y-scale) + (send bdc clear) + (send bdc draw-bitmap orig-mask 0 0)) (send bdc set-bitmap #f)