From fbacede604399b7261282f7cbdb20b3e05bfbc3a Mon Sep 17 00:00:00 2001 From: wangjialiang Date: Thu, 25 Mar 2021 18:04:47 +0800 Subject: [PATCH] ble_mesh: stack: Fix crash for net_key_del when subnet is NULL --- components/bt/esp_ble_mesh/mesh_core/cfg_srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c b/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c index e32510d0a0..d0d29f7fdd 100644 --- a/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c +++ b/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c @@ -2352,7 +2352,7 @@ send_status: if (status == STATUS_SUCCESS) { bt_mesh_cfg_server_state_change_t change = {0}; - change.cfg_netkey_delete.net_idx = sub->net_idx; + change.cfg_netkey_delete.net_idx = sub ? sub->net_idx : BLE_MESH_KEY_UNUSED; bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change)); }