Don't crash if set_app_info is called before adding metadata

set_mime_type, set_is_private, add_group, set_groups, set_icon, etc
all added metadata before using it. If set_app_info was called before
any of those it would crash when trying to access the metadata.
This commit is contained in:
William Jon McCann 2012-08-24 13:32:25 -04:00
parent dbf9f7a288
commit dbad8304ff

View File

@ -3234,6 +3234,9 @@ g_bookmark_file_set_app_info (GBookmarkFile *bookmark,
} }
} }
if (!item->metadata)
item->metadata = bookmark_metadata_new ();
ai = bookmark_item_lookup_app_info (item, name); ai = bookmark_item_lookup_app_info (item, name);
if (!ai) if (!ai)
{ {