[sysprof/wip/chergert/sysprof-3] tests: check for NULL before strcmp



commit edf9207b7b881e7098ca64fd0a8ddad0744b49c2
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 20 12:26:03 2019 -0700

    tests: check for NULL before strcmp

 src/tests/test-model-filter.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/tests/test-model-filter.c b/src/tests/test-model-filter.c
index fb856a6..dbe87c0 100644
--- a/src/tests/test-model-filter.c
+++ b/src/tests/test-model-filter.c
@@ -128,7 +128,10 @@ filter_keyword_cb (GObject  *object,
   const gchar *haystack = sysprof_process_model_item_get_command_line (item);
   const gchar *needle = user_data;
 
-  return strstr (haystack, needle) != NULL;
+  if (haystack && needle)
+    return strstr (haystack, needle) != NULL;
+
+  return FALSE;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]