[sysprof] libsysprof-ui: protect against NULL
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof-ui: protect against NULL
- Date: Wed, 29 May 2019 22:26:49 +0000 (UTC)
commit 93215bd4e7ddd3c151fbc61468af1a3aa19fd971
Author: Christian Hergert <chergert redhat com>
Date: Mon May 13 22:53:17 2019 -0700
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 b760987..6c902a8 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]