Skip to content

Commit 8b2f5e1

Browse files
author
NoahAndrews
committed
Fix null dereference
1 parent 08f645c commit 8b2f5e1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/native/cpp/Drivers/CandleWinUSB/CandleWinUSBDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ CANStatus CandleWinUSBDevice::ReceiveCANMessage(std::shared_ptr<CANMessage>& msg
140140
if (
141141
CANBridge_ProcessMask({m.second->GetMessageId(), 0}, m.first)
142142
&& CANBridge_ProcessMask({messageID, messageMask}, m.first)
143-
&& m.second->GetTimestampUs() > mostRecent->GetTimestampUs()
143+
&& (!mostRecent || m.second->GetTimestampUs() > mostRecent->GetTimestampUs())
144144
) {
145145
mostRecent = m.second;
146146
status = CANStatus::kOk;

src/main/native/cpp/Drivers/Serial/SerialDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ CANStatus SerialDevice::ReceiveCANMessage(std::shared_ptr<CANMessage>& msg, uint
9494
if (
9595
CANBridge_ProcessMask({m.second->GetMessageId(), 0}, m.first)
9696
&& CANBridge_ProcessMask({messageID, messageMask}, m.first)
97-
&& m.second->GetTimestampUs() > mostRecent->GetTimestampUs()
97+
&& (!mostRecent || m.second->GetTimestampUs() > mostRecent->GetTimestampUs())
9898
) {
9999
mostRecent = m.second;
100100
status = CANStatus::kOk;

0 commit comments

Comments
 (0)