mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
Merge "DigitalInput: Don't crash on Get() of invalid channel."
This commit is contained in:
@@ -62,6 +62,7 @@ DigitalInput::~DigitalInput() {
|
||||
* Retrieve the value of a single digital input channel from the FPGA.
|
||||
*/
|
||||
bool DigitalInput::Get() const {
|
||||
if (StatusIsFatal()) return false;
|
||||
int32_t status = 0;
|
||||
bool value = getDIO(m_digital_ports[m_channel], &status);
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
|
||||
Reference in New Issue
Block a user