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));