bt-core: Fix bt-core crash
[platform/core/connectivity/bluetooth-frwk.git] / bt-core / bt-core-dbus-handler.c
index c9c07c3..0d04f33 100755 (executable)
@@ -113,7 +113,7 @@ int _bt_core_start_httpproxy(void)
 {
        GVariant *variant = NULL;
        unsigned char enabled;
-
+       GError *err = NULL;
        BT_DBG(" ");
 
        hps_gproxy = _bt_core_gdbus_get_hps_proxy();
@@ -123,7 +123,11 @@ int _bt_core_start_httpproxy(void)
        }
 
        variant = g_dbus_proxy_call_sync(hps_gproxy, "enable",
-                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err);
+       if (err) {
+               BT_ERR("Error : %s" , err->message);
+               g_clear_error(&err);
+       }
        if (variant) {
                g_variant_get(variant, "(y)", &enabled);
                BT_ERR("HPS enabled status 0x%x", enabled);
@@ -135,7 +139,7 @@ int _bt_core_stop_httpproxy(void)
 {
        GVariant *variant = NULL;
        unsigned char enabled;
-
+       GError *err = NULL;
        BT_DBG(" ");
 
        hps_gproxy = _bt_core_gdbus_get_hps_proxy();
@@ -145,7 +149,11 @@ int _bt_core_stop_httpproxy(void)
        }
 
        variant = g_dbus_proxy_call_sync(hps_gproxy, "disable",
-                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err);
+       if (err) {
+               BT_ERR("Error : %s" , err->message);
+               g_clear_error(&err);
+       }
        if (variant) {
                g_variant_get(variant, "(y)", &enabled);
                BT_ERR("HPS disabled status 0x%x", enabled);