Fix: Added gatt server validation before GATT service is deleted 98/177498/1 accepted/tizen/unified/20180502.071119 submit/tizen/20180501.234536
authorAmit Purwar <amit.purwar@samsung.com>
Mon, 30 Apr 2018 12:00:11 +0000 (17:30 +0530)
committerAmit Purwar <amit.purwar@samsung.com>
Mon, 30 Apr 2018 12:04:31 +0000 (17:34 +0530)
Change-Id: I374e17715d08155956c4104de7f1689b0a9f26f9
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
src/bluetooth-gatt.c

index 078d14739de977cb9e4cfd26ef39f4a6ed86bcd3..520b580b8e2c30b36e8f291aa4a759c4b91b230d 100644 (file)
@@ -523,11 +523,13 @@ static void __bt_gatt_free_service(bt_gatt_h gatt_handle)
 
        if (svc->role == BT_GATT_ROLE_SERVER) {
 #ifdef TIZEN_FEATURE_GATT_RELAY
-               BT_INFO("GATT Server Delete Service: service handle [%d] Inst ID [%d]", svc->handle, instance_id);
-               ret = _bt_get_error_code(bluetooth_gatt_server_delete_service(svc->handle, instance_id));
-               if (ret != BT_ERROR_NONE) {
-                       BT_ERR("%s(0x%08x)",
-                                       _bt_convert_error_to_string(ret), ret);
+               if (is_gatt_server_initialized) {
+                       BT_INFO("GATT Server Delete Service: service handle [%d] Inst ID [%d]", svc->handle, instance_id);
+                       ret = _bt_get_error_code(bluetooth_gatt_server_delete_service(svc->handle, instance_id));
+                       if (ret != BT_ERROR_NONE) {
+                               BT_ERR("%s(0x%08x)",
+                                               _bt_convert_error_to_string(ret), ret);
+                       }
                }
 #else
                ret = _bt_get_error_code(bluetooth_gatt_unregister_service(svc->path));