sdl:load-image will seg fault if you attempt to load an image that isn't a
bitmap.
I checked the source and its just because it doesn't check for a null
pointer return from SDL_Load_BMP_RW.
I wrote a patch to simply raise an error with the sdl-cffi:sdl-get-error in
the text if thats the case.

Hope it helps

-Nate
Index: image.lisp
===================================================================
--- image.lisp	(revision 1208)
+++ image.lisp	(working copy)
@@ -1,11 +1,17 @@
 
 (in-package #:lispbuilder-sdl)
-                         
+
+                    
 (defmethod load-image ((source rwops) &key color-key alpha image-type force free-rwops (color-key-at nil))
   "Returns a new `SURFACE` from the `RWOPS` in `SOURCE`."
   (declare (ignore image-type force))
-  (let ((surf (make-instance 'surface
-			     :using-surface (sdl-cffi::SDL-Load-BMP-RW (fp source) 0)
+  
+  (let* ((surf-ptr (sdl-cffi::SDL-Load-BMP-RW (fp source) 0))
+	 (surf (make-instance 'surface
+			      :using-surface (if (cffi-sys:null-pointer-p surf-ptr)
+						(error "SDL-Load-BMP-RW Error '~a'" (sdl-cffi::sdl-get-error))
+						surf-ptr)
+						
 			     :enable-color-key (or color-key color-key-at)
 			     :color-key color-key
 			     :color-key-at color-key-at
_______________________________________________
application-builder mailing list
application-builder@lispniks.com
http://www.lispniks.com/mailman/listinfo/application-builder

Reply via email to