From e36d1d2f8a7ef44451ed4a95ba351dae3beb0052 Mon Sep 17 00:00:00 2001 From: lly Date: Mon, 13 Apr 2020 18:07:10 +0800 Subject: [PATCH] ble_mesh: Check if appkey exist before deleting it --- components/bt/esp_ble_mesh/mesh_core/provisioner_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c b/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c index f84fcd491..658aa3264 100644 --- a/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c +++ b/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c @@ -1384,7 +1384,7 @@ int bt_mesh_provisioner_local_net_key_delete(u16_t net_idx) /* Delete any app keys bound to this NetKey index */ for (j = 0; j < ARRAY_SIZE(bt_mesh.p_app_keys); j++) { struct bt_mesh_app_key *key = bt_mesh.p_app_keys[j]; - if (key->net_idx == sub->net_idx) { + if (key && key->net_idx == sub->net_idx) { bt_mesh_provisioner_local_app_key_delete(key->net_idx, key->app_idx); } }