Diff between 3508e02e9adc2ccde2df4a660217b57def834432 and b8b58262e995555e290b5967057ace3f81e6bede

Changed Files

File Additions Deletions Status
src/shared/gatt-db.c +5 -0 modified

Full Patch

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index 3d2e690..2a00171 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -1551,6 +1551,10 @@ bool gatt_db_attribute_write(struct gatt_db_attribute *attrib, uint16_t offset,
 		return true;
 	}
 
+	/* Nothing to write just skip */
+	if (len == 0)
+		goto done;
+
 	/* For values stored in db allocate on demand */
 	if (!attrib->value || offset >= attrib->value_len ||
 				len > (unsigned) (attrib->value_len - offset)) {
@@ -1571,6 +1575,7 @@ bool gatt_db_attribute_write(struct gatt_db_attribute *attrib, uint16_t offset,
 
 	memcpy(&attrib->value[offset], value, len);
 
+done:
 	func(attrib, 0, user_data);
 
 	return true;