summaryrefslogtreecommitdiff
path: root/libappstream-glib/as-store.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2017-02-02 12:59:45 +0000
committerRichard Hughes <richard@hughsie.com>2017-02-02 12:59:45 +0000
commitabe89211fbf878dc8b6c8324ca2a621718bc1732 (patch)
treed5665cd30a1bd2a0ad4d30824d4574a627140cc7 /libappstream-glib/as-store.c
parentf2700a88ff7cf8cdeafa8dc64d21311f14aef6d8 (diff)
downloadappstream-glib-abe89211fbf878dc8b6c8324ca2a621718bc1732.tar.gz
trivial: Fix a crash when removing apps from the store
Diffstat (limited to 'libappstream-glib/as-store.c')
-rw-r--r--libappstream-glib/as-store.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index b203797..a36df6c 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -924,13 +924,14 @@ as_store_remove_app (AsStore *store, AsApp *app)
/* only remove this specific unique app */
apps = g_hash_table_lookup (priv->hash_id, as_app_get_id (app));
- if (apps != NULL)
+ if (apps != NULL) {
g_ptr_array_remove (apps, app);
- /* remove the array as well if it was the last app as the AsRefString
- * with the app ID may get freed now */
- if (apps->len == 0)
- g_hash_table_remove (priv->hash_id, as_app_get_id (app));
+ /* remove the array as well if it was the last app as the
+ * AsRefString with the app ID may get freed now */
+ if (apps->len == 0)
+ g_hash_table_remove (priv->hash_id, as_app_get_id (app));
+ }
g_hash_table_remove (priv->hash_unique_id, as_app_get_unique_id (app));
g_ptr_array_remove (priv->array, app);