Skip to content

Commit ead6c49

Browse files
committed
Don't send if not open.
1 parent d38b5f8 commit ead6c49

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/async_port/async_can.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ void AsyncCAN::ReadFromPort(struct can_frame &rec_frame,
124124
}
125125

126126
void AsyncCAN::SendFrame(const struct can_frame &frame) {
127+
if (!socketcan_stream_.is_open()) {
128+
return;
129+
}
127130
socketcan_stream_.async_write_some(
128131
asio::buffer(&frame, sizeof(frame)),
129132
[](asio::error_code error, size_t bytes_transferred) {

0 commit comments

Comments
 (0)