The Glk program now fails gracefully when trying to load an image
resource without having loaded a resource map first: it prints a warning
and doesn't load the image, instead of crashing.
priv->char_input_queue = g_async_queue_new();
priv->line_input_queue = g_async_queue_new();
/* Should be g_async_queue_new_full(g_free); but only in GTK >= 2.16 */
+ priv->resource_map = NULL;
priv->resource_lock = g_mutex_new();
priv->resource_loaded = g_cond_new();
priv->resource_info_available = g_cond_new();
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) );