From 93215bd4e7ddd3c151fbc61468af1a3aa19fd971 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 13 May 2019 22:53:17 -0700 Subject: [PATCH] libsysprof-ui: protect against NULL --- src/libsysprof-ui/pointcache.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libsysprof-ui/pointcache.c b/src/libsysprof-ui/pointcache.c index b7609873..6c902a82 100644 --- a/src/libsysprof-ui/pointcache.c +++ b/src/libsysprof-ui/pointcache.c @@ -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; }