OSDN Git Service

Fix HID crashing on no descriptor
authorJakub Pawlowski <jpawlowski@google.com>
Tue, 13 Jun 2017 21:16:57 +0000 (14:16 -0700)
committerJakub Pawlowski <jpawlowski@google.com>
Tue, 13 Jun 2017 23:47:56 +0000 (16:47 -0700)
Bug: 62461796
Test: compilation test
Change-Id: Ic7b1fcc4b6f3c8680f1810679ed609f2691fa4aa

bta/hh/bta_hh_le.cc

index a30f8b8..da503ac 100644 (file)
@@ -1443,6 +1443,11 @@ static void read_report_ref_desc_cb(uint16_t conn_id, tGATT_STATUS status,
   const tBTA_GATTC_DESCRIPTOR* p_desc =
       BTA_GATTC_GetDescriptor(conn_id, handle);
 
+  if (!p_desc) {
+    APPL_TRACE_ERROR("%s: error: descriptor is null!", __func__);
+    return;
+  }
+
   tBTA_HH_LE_RPT* p_rpt;
   p_rpt = bta_hh_le_find_report_entry(
       p_dev_cb, p_desc->characteristic->service->handle, GATT_UUID_HID_REPORT,