mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilibc] Check for invalid handle in destructors (#7212)
Moved-from objects have invalid handles.
This commit is contained in:
@@ -84,10 +84,12 @@ Counter::Counter(EncodingType encodingType,
|
||||
}
|
||||
|
||||
Counter::~Counter() {
|
||||
try {
|
||||
SetUpdateWhenEmpty(true);
|
||||
} catch (const RuntimeError& e) {
|
||||
e.Report();
|
||||
if (m_counter != HAL_kInvalidHandle) {
|
||||
try {
|
||||
SetUpdateWhenEmpty(true);
|
||||
} catch (const RuntimeError& e) {
|
||||
e.Report();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user