Diff between 441ebd51933dc108b15069cc70e3e359b9cf054f and 496e962769b589980499a35e1b6a21a586b3048c

Changed Files

File Additions Deletions Status
android/gatt.c +6 -4 modified

Full Patch

diff --git a/android/gatt.c b/android/gatt.c
index 467182e..8b6810c 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -4985,14 +4985,16 @@ static void handle_server_add_characteristic(const void *buf, uint16_t len)
 							cmd->properties,
 							read_cb, write_cb,
 							INT_TO_PTR(app_id));
-	if (!attrib)
+	if (!attrib) {
 		status = HAL_STATUS_FAILED;
-	else
-		status = HAL_STATUS_SUCCESS;
+		goto failed;
+	}
+
+	ev.char_handle = gatt_db_attribute_get_handle(attrib);
+	status = HAL_STATUS_SUCCESS;
 
 failed:
 	ev.srvc_handle = cmd->service_handle;
-	ev.char_handle = gatt_db_attribute_get_handle(attrib);
 	ev.status = status;
 	ev.server_if = app_id;
 	ev.status = status == HAL_STATUS_SUCCESS ? GATT_SUCCESS : GATT_FAILURE;