Fixed minor bug in glk_image_get_info()
[projects/chimara/chimara.git] / libchimara / graphics.c
index c87a148390aa0dc05fdd17a7114ac1ca6aa883e4..a8a0318bd86ff19838c80a07a0849f284c851862 100644 (file)
@@ -22,6 +22,10 @@ load_image_in_cache(glui32 image, gint width, gint height)
        guchar *buffer;
 
        /* Lookup the proper resource */
+       if(!glk_data->resource_map) {
+               WARNING("No resource map has been loaded yet.");
+               return NULL;
+       }
        blorb_error = giblorb_load_resource(glk_data->resource_map, giblorb_method_FilePos, &resource, giblorb_ID_Pict, image);
        if(blorb_error != giblorb_err_None) {
                WARNING_S( "Error loading resource", giblorb_get_error_message(blorb_error) );
@@ -216,7 +220,7 @@ glk_image_get_info(glui32 image, glui32 *width, glui32 *height)
 
        if(width != NULL)
                *width = found->width;
-       if(width != NULL)
+       if(height != NULL)
                *height = found->height;
        return TRUE;
 }