libsysprof-ui: protect against NULL

This commit is contained in:
Christian Hergert
2019-05-13 22:53:17 -07:00
parent 4530a982f8
commit 93215bd4e7

View File

@ -99,7 +99,13 @@ point_cache_get_points (PointCache *self,
{
GArray *ar;
ar = g_hash_table_lookup (self->sets, GUINT_TO_POINTER (set_id));
*n_points = ar->len;
return &g_array_index (ar, const Point, 0);
*n_points = 0;
if ((ar = g_hash_table_lookup (self->sets, GUINT_TO_POINTER (set_id))))
{
*n_points = ar->len;
return &g_array_index (ar, const Point, 0);
}
return NULL;
}