diff options
author | David Thompson <dthompson@member.fsf.org> | 2013-08-25 14:48:51 -0400 |
---|---|---|
committer | David Thompson <dthompson@member.fsf.org> | 2013-08-25 14:48:51 -0400 |
commit | c8f8ad1319d3946e58626df3afee6205e084b76b (patch) | |
tree | 68a61c0fffd97e88ef7cad19ad6443e78de0c41f /2d/texture.scm | |
parent | b740960d681e6c0985dbdb734d6486784c9a370b (diff) | |
parent | fd326a63b6ef49257c165289e8244bff92ef0994 (diff) |
Merge branch 'master' of github.com:davexunit/guile-2d
Diffstat (limited to '2d/texture.scm')
-rw-r--r-- | 2d/texture.scm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/2d/texture.scm b/2d/texture.scm index b7808b3..19c26c8 100644 --- a/2d/texture.scm +++ b/2d/texture.scm @@ -132,7 +132,13 @@ 0 0 1 1))) (define (load-bitmap filename) - (let* ((bitmap (freeimage-load (freeimage-get-file-type filename) filename)) + ;; Throw an error if image file does not exist or else we will + ;; segfault later. + (unless (file-exists? filename) + (throw 'image-not-found filename)) + ;; Load image and convert it to 32 bit color. + (let* ((image-type (freeimage-get-file-type filename)) + (bitmap (freeimage-load image-type filename)) (32bit-bitmap (freeimage-convert-to-32-bits bitmap))) (freeimage-unload bitmap) 32bit-bitmap)) |