Skip to content

Commit 3fe18a1

Browse files
committed
BLE:Cordio:Fix insert characteristic not handle error
1 parent fa65546 commit 3fe18a1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioGattServer.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,22 +196,32 @@ ble_error_t GattServer::insert_characteristic(
196196

197197
// Create Characteristic Declaration Attribute
198198
insert_characteristic_declaration_attribute(characteristic, attribute_it);
199-
insert_characteristic_value_attribute(characteristic, attribute_it);
199+
ble_error_t err = insert_characteristic_value_attribute(characteristic, attribute_it);
200+
if (err) {
201+
return err;
202+
}
203+
200204

201205
// insert descriptors
202206
bool cccd_created = false;
203207
for (size_t i = 0; i < characteristic->getDescriptorCount(); i++) {
204-
insert_descriptor(
208+
err = insert_descriptor(
205209
characteristic,
206210
characteristic->getDescriptor(i),
207211
attribute_it,
208212
cccd_created
209213
);
214+
if (err) {
215+
return err;
216+
}
210217
}
211218

212219
// insert implicit CCCD
213220
if ((properties & UPDATE_PROPERTIES) && (cccd_created == false)) {
214-
insert_cccd(characteristic, attribute_it);
221+
err = insert_cccd(characteristic, attribute_it);
222+
if (err) {
223+
return err;
224+
}
215225
}
216226

217227
return BLE_ERROR_NONE;

0 commit comments

Comments
 (0)