summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2017-01-06 13:19:33 +0000
committerRichard Hughes <richard@hughsie.com>2017-01-06 13:19:39 +0000
commitfd45ec178fd8f114a2c7ef334cf88a23f4fc0436 (patch)
tree5f82cf6245ee4eb7f6d272b134eb09ab49aaff30
parent5796404dd9d92d120a010ada06eb313e8dd204ba (diff)
downloadappstream-glib-fd45ec178fd8f114a2c7ef334cf88a23f4fc0436.tar.gz
Fix a crash when using as_release_get_location_default()
The locations array is now lazy-loaded.
-rw-r--r--libappstream-glib/as-release.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libappstream-glib/as-release.c b/libappstream-glib/as-release.c
index 72c81ff..ce756a5 100644
--- a/libappstream-glib/as-release.c
+++ b/libappstream-glib/as-release.c
@@ -355,6 +355,8 @@ const gchar *
as_release_get_location_default (AsRelease *release)
{
AsReleasePrivate *priv = GET_PRIVATE (release);
+ if (priv->locations == NULL)
+ return NULL;
if (priv->locations->len == 0)
return NULL;
return g_ptr_array_index (priv->locations, 0);