Bluetooth: shell: Fix null check in cmd_conn_phy_update

Null check in case of system failure.

Signed-off-by: Kai Ren <renkaikaiser@163.com>
This commit is contained in:
Kai Ren 2021-04-17 09:41:45 +08:00 committed by Johan Hedberg
commit de16299c62

View file

@ -2179,6 +2179,13 @@ static int cmd_conn_phy_update(const struct shell *shell, size_t argc,
struct bt_conn_le_phy_param param; struct bt_conn_le_phy_param param;
int err; 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_tx_phy = strtoul(argv[1], NULL, 16);
param.pref_rx_phy = param.pref_tx_phy; param.pref_rx_phy = param.pref_tx_phy;
param.options = BT_CONN_LE_PHY_OPT_NONE; param.options = BT_CONN_LE_PHY_OPT_NONE;