From 9e2ddae05c6aad66d08f0cbb66c4f8f9ef25cf4e Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 19 May 2023 10:13:01 -0700 Subject: [PATCH] libsysprof-analyze: make string functions recognize NULL --- src/libsysprof-analyze/sysprof-strings.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libsysprof-analyze/sysprof-strings.c b/src/libsysprof-analyze/sysprof-strings.c index 319d4219..a7c13f4e 100644 --- a/src/libsysprof-analyze/sysprof-strings.c +++ b/src/libsysprof-analyze/sysprof-strings.c @@ -70,6 +70,9 @@ sysprof_strings_get (SysprofStrings *self, { GRefString *ret; + if (string == NULL) + return NULL; + g_mutex_lock (&self->mutex); if (!(ret = g_hash_table_lookup (self->hashtable, string))) { @@ -88,6 +91,9 @@ sysprof_strings_lookup (SysprofStrings *self, { GRefString *ret; + if (string == NULL) + return NULL; + g_mutex_lock (&self->mutex); ret = g_hash_table_lookup (self->hashtable, string); g_mutex_unlock (&self->mutex);