Bluetooth: Add CHECK and move ASSERT
Test: bluetooth_hidl_hal_test passes
Change-Id: Ib857265204d39ffb54afc6f589fdc1b852362a97
diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc
index 7f14e68..7737dd2 100644
--- a/bluetooth/1.0/default/vendor_interface.cc
+++ b/bluetooth/1.0/default/vendor_interface.cc
@@ -414,6 +414,7 @@
hci_packet_.data() + preamble_size_for_type[hci_packet_type_] +
hci_packet_bytes_read_,
hci_packet_bytes_remaining_));
+ CHECK(bytes_read > 0);
hci_packet_bytes_remaining_ -= bytes_read;
hci_packet_bytes_read_ += bytes_read;
if (hci_packet_bytes_remaining_ == 0) {
diff --git a/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp b/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp
index 683029e..eb1cdc1 100644
--- a/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp
+++ b/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp
@@ -122,9 +122,9 @@
virtual void SetUp() override {
// currently test passthrough mode only
bluetooth = IBluetoothHci::getService();
+ ASSERT_NE(bluetooth, nullptr);
ALOGW("%s: getService() for bluetooth is %s", __func__,
bluetooth->isRemote() ? "remote" : "local");
- ASSERT_NE(bluetooth, nullptr);
bluetooth_cb = new BluetoothHciCallbacks(*this);
ASSERT_NE(bluetooth_cb, nullptr);