Added check for GVariant parameter type in ScanDone event. 43/154243/1 accepted/tizen/4.0/unified/20171011.071437 submit/tizen_4.0/20171010.085454
authorJaehyun Kim <jeik01.kim@samsung.com>
Tue, 10 Oct 2017 01:58:14 +0000 (10:58 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Tue, 10 Oct 2017 01:59:28 +0000 (10:59 +0900)
Description: Extract value from GVariant parameter received in ScanDone
event only if GVariant type is "(sv)".

Change-Id: I1476189a14ffcd727e51c9e519166f2aa0ab890d
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/network_signal.c

index bff14cb146b64d2ac0652d431a1e708f261b623c..0978f44b32990ef233a497fb7e669c93a270c884 100755 (executable)
@@ -724,18 +724,22 @@ static int __net_handle_scan_done(GVariant *param)
        GVariant *value;
        int last_scan_type = -1;
 
-       g_variant_get(param, "(sv)", &key, &value);
-       WIFI_LOG(WIFI_INFO, "key: %s", key);
-       if (g_variant_is_of_type(value, G_VARIANT_TYPE_INT32)) {
+       WIFI_LOG(WIFI_INFO, "param type: %s", g_variant_get_type_string(param));
+
+       if (g_variant_is_of_type(param, ((const GVariantType *)"(sv)"))) {
+               g_variant_get(param, "(sv)", &key, &value);
+               WIFI_LOG(WIFI_INFO, "key: %s", key);
                if (g_strcmp0(key, "Scantype") == 0) {
-                       last_scan_type = g_variant_get_int32(value);
-                       WIFI_LOG(WIFI_INFO, "last scan type: %d (0:full,1:specific,2:multi)", last_scan_type);
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_INT32)) {
+                               last_scan_type = g_variant_get_int32(value);
+                               WIFI_LOG(WIFI_INFO, "last scan type: %d (0:full,1:specific,2:multi)", last_scan_type);
+                       }
                }
-       }
 
-       g_free((gchar *)key);
-       if (NULL != value)
-               g_variant_unref(value);
+               g_free((gchar *)key);
+               if (NULL != value)
+                       g_variant_unref(value);
+       }
 
        /* Check if any scan request is pending, if scan request is pending then
         * do not send scan-done signal to application and invoke pending scan request. */