diff --git a/tmk_core/protocol/nrf/sdk12/ble_master.c b/tmk_core/protocol/nrf/sdk12/ble_master.c index 787390169ba8..669b7ace501d 100644 --- a/tmk_core/protocol/nrf/sdk12/ble_master.c +++ b/tmk_core/protocol/nrf/sdk12/ble_master.c @@ -1380,7 +1380,7 @@ void restart_advertising_id(uint8_t id) { m_whitelist_peer_cnt = (sizeof(m_whitelist_peers) / sizeof(pm_peer_id_t)); peer_list_get(m_whitelist_peers, &m_whitelist_peer_cnt); - if (id > m_whitelist_peer_cnt) { + if (id >= m_whitelist_peer_cnt) { return; } m_whitelist_peer_cnt = 1; diff --git a/tmk_core/protocol/nrf/sdk15/ble_master.c b/tmk_core/protocol/nrf/sdk15/ble_master.c index 840e70f1bc9c..79a5a931798b 100644 --- a/tmk_core/protocol/nrf/sdk15/ble_master.c +++ b/tmk_core/protocol/nrf/sdk15/ble_master.c @@ -1305,10 +1305,13 @@ void restart_advertising_id(uint8_t id) { m_whitelist_peer_cnt = (sizeof(m_whitelist_peers) / sizeof(pm_peer_id_t)); peer_list_get(m_whitelist_peers, &m_whitelist_peer_cnt); - if (id > m_whitelist_peer_cnt) { + if (id >= m_whitelist_peer_cnt) { return; } #ifdef NRF_SEPARATE_KEYBOARD_MASTER + if (id == 0) { + return; + } m_whitelist_peer_cnt = 2; m_whitelist_peers[1] = m_whitelist_peers[id]; #else