Merge the code from tizen_2.4
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-avrcp.c
index 0db7daf..49397e2 100644 (file)
@@ -155,7 +155,7 @@ static void __bt_avrcp_agent_method(GDBusConnection *connection,
        gchar *interface = NULL;
        gchar *property = NULL;
        gchar *loop_status = NULL;
-       GVariant *value;
+       GVariant *value = NULL;
 
        if (g_strcmp0(method_name, "Set") == 0) {
                g_variant_get(parameters, "(&s&sv)", &interface, &property,
@@ -167,6 +167,11 @@ static void __bt_avrcp_agent_method(GDBusConnection *connection,
                }
        }
 
+       if (value == NULL) {
+               BT_ERR("value is NULL");
+               goto fail;
+       }
+
        BT_DBG("Property: %s\n", property);
        if (g_strcmp0(property, "Shuffle") == 0) {
 
@@ -215,7 +220,8 @@ static void __bt_avrcp_agent_method(GDBusConnection *connection,
        return;
 
 fail:
-       g_variant_unref(value);
+       if (value)
+               g_variant_unref(value);
        err = __bt_avrcp_set_error(ret);
        g_dbus_method_invocation_return_gerror(invocation, err);
        g_clear_error(&err);