Check if image exists before caching it
authorP. F. Chimento <philip.chimento@gmail.com>
Thu, 4 Aug 2011 18:23:49 +0000 (20:23 +0200)
committerP. F. Chimento <philip.chimento@gmail.com>
Thu, 4 Aug 2011 18:27:21 +0000 (20:27 +0200)
If a resource load callback returns an invalid file name, for example,
then the image operation should be aborted.

libchimara/graphics.c

index afe3e76386a75899cda8850260cd68f566513cb8..0c3215a6f3c66f01b1c50bb63a259ff844a49d3f 100644 (file)
@@ -123,6 +123,9 @@ load_image_in_cache(glui32 image, gint width, gint height)
                info = load_image_from_blorb(resource, image, width, height);
        }
 
+       if(info == NULL)
+               return NULL;
+
        /* Store the image in the cache */
        gdk_threads_enter();