mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Adds check for PWM overallocation (#392)
This commit is contained in:
committed by
Peter Johnson
parent
a705eb1c61
commit
8216d85e52
@@ -50,7 +50,7 @@ HAL_DigitalHandle HAL_InitializePWMPort(HAL_PortHandle portHandle,
|
||||
if (*status != 0) return HAL_kInvalidHandle;
|
||||
|
||||
int16_t channel = getPortHandleChannel(portHandle);
|
||||
if (channel == InvalidHandleIndex) {
|
||||
if (channel == InvalidHandleIndex || channel >= kNumPWMChannels) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user