mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
[hal] Fix segfault in various HAL functions (#4891)
This commit is contained in:
@@ -85,6 +85,9 @@ HAL_CANHandle HAL_InitializeCAN(HAL_CANManufacturer manufacturer,
|
||||
|
||||
void HAL_CleanCAN(HAL_CANHandle handle) {
|
||||
auto data = canHandles->Free(handle);
|
||||
if (data == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::scoped_lock lock(data->mapMutex);
|
||||
|
||||
|
||||
@@ -710,6 +710,9 @@ void HAL_StopDMA(HAL_DMAHandle handle, int32_t* status) {
|
||||
|
||||
void* HAL_GetDMADirectPointer(HAL_DMAHandle handle) {
|
||||
auto dma = dmaHandles->Get(handle);
|
||||
if (dma == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return dma.get();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user