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 authored and jhedberg committed Apr 20, 2021
1 parent 7309119 commit de16299
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 @@ -2179,6 +2179,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 de16299

Please sign in to comment.