From c97e1aafb124e1906c951721eb2e9bb2b8813a8b Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Thu, 5 Mar 2020 18:32:03 +0100 Subject: [PATCH] Bluetooth: Mesh: Fix possible NULL dereference in BT_DBG statement. Fix possible NULL dereference in BT_DBG statement when bt_mesh_friend_get is called before a successful cfg_srv init Signed-off-by: Joakim Andersson --- subsys/bluetooth/mesh/cfg_srv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/cfg_srv.c b/subsys/bluetooth/mesh/cfg_srv.c index 884906695b5..3d66db784ce 100644 --- a/subsys/bluetooth/mesh/cfg_srv.c +++ b/subsys/bluetooth/mesh/cfg_srv.c @@ -3416,7 +3416,8 @@ u8_t bt_mesh_relay_get(void) u8_t bt_mesh_friend_get(void) { - BT_DBG("conf %p conf->frnd 0x%02x", conf, conf->frnd); + BT_DBG("conf %p conf->frnd 0x%02x", conf, + conf ? conf->frnd : BT_MESH_FRIEND_NOT_SUPPORTED); if (conf) { return conf->frnd;