Prevent the exception case in GATT connect 48/228548/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 24 Mar 2020 01:10:36 +0000 (10:10 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 24 Mar 2020 01:10:36 +0000 (10:10 +0900)
If kernel's crypto API does not work, we can't use
GATT database hash. So we add the exception case
for this.

Change-Id: Id4e5e9b7ff814aedd3f3e43d689ced3be8ee25dd
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
src/gatt-database.c

index 54c84b3..3eeebb3 100644 (file)
@@ -1326,6 +1326,14 @@ static void db_hash_read_cb(struct gatt_db_attribute *attrib,
 
        hash = gatt_db_get_hash(database->db);
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       /* Kernel's crypto API does not support, hash value will be NULL */
+       if (hash == NULL) {
+               error("hash is NULL");
+               return;
+       }
+#endif
+
        gatt_db_attribute_read_result(attrib, id, 0, hash, 16);
 
        if (!get_dst_info(att, &bdaddr, &bdaddr_type))