Skip to content

Commit

Permalink
Bluetooth: shell: Fix null check in cmd_conn_phy_update
Browse files Browse the repository at this point in the history
Null check in case of system failure.

Signed-off-by: Kai Ren <renkaikaiser@163.com>
  • Loading branch information
kaiser-ren committed Apr 19, 2021
1 parent b6ad85c commit 5150f7d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions subsys/bluetooth/shell/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2141,6 +2141,13 @@ static int cmd_conn_phy_update(const struct shell *shell, size_t argc,
struct bt_conn_le_phy_param param;
int err;

if (default_conn == NULL) {
shell_error(shell,
"%s: at least, one connection is required",
shell->ctx->active_cmd.syntax);
return -ENOEXEC;
}

param.pref_tx_phy = strtoul(argv[1], NULL, 16);
param.pref_rx_phy = param.pref_tx_phy;
param.options = BT_CONN_LE_PHY_OPT_NONE;
Expand Down

0 comments on commit 5150f7d

Please sign in to comment.