diff --git a/android/gatt.c b/android/gatt.c
index 2ee2d05..cccf23e 100644
--- a/android/gatt.c
+++ b/android/gatt.c
(uint8_t *)cmd->value, cmd->len,
pdu, mtu);
- g_attrib_send(conn->device->attrib, 0, pdu, length, NULL, NULL, NULL);
-
- status = HAL_STATUS_SUCCESS;
+ if (length == 0) {
+ error("gatt: Failed to encode indication");
+ status = HAL_STATUS_FAILED;
+ } else {
+ g_attrib_send(conn->device->attrib, 0, pdu, length, NULL, NULL,
+ NULL);
+ status = HAL_STATUS_SUCCESS;
+ }
reply:
ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,