[TensorIf] add a NULL checker
authorHyoung Joo Ahn <hello.ahn@samsung.com>
Tue, 30 Mar 2021 02:47:36 +0000 (11:47 +0900)
committerwooksong <wook16.song@samsung.com>
Tue, 30 Mar 2021 07:31:24 +0000 (16:31 +0900)
To improve code quality, I want to suggest a null checker.

Signed-off-by: Hyoung Joo Ahn <hello.ahn@samsung.com>
gst/nnstreamer/tensor_if/gsttensorif.c

index 1889db9..c962f68 100644 (file)
@@ -370,9 +370,18 @@ gst_tensor_if_set_property_supplied_value (const GValue * value,
 {
   gint i;
   gboolean is_float = FALSE;
-  const gchar *param = g_value_get_string (value);
-  gchar **strv = g_strsplit_set (param, delimiters, -1);
-  gint num = g_strv_length (strv);
+  const gchar *param;
+  gchar **strv;
+  gint num;
+
+  if (!value) {
+    ml_loge ("Invalid supplied value. The value is NULL");
+    return;
+  }
+
+  param = g_value_get_string (value);
+  strv = g_strsplit_set (param, delimiters, -1);
+  num = g_strv_length (strv);
 
   if (strchr (param, '.') || strchr (param, 'E') || strchr (param, 'e')) {
     is_float = TRUE;