mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
b can
possible nullptr usage fix
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
#include <magic_enum/magic_enum.hpp>
|
#include <magic_enum/magic_enum.hpp>
|
||||||
|
|
||||||
CAN_Interface::CAN_Interface(QObject *parent) : QObject(parent)
|
CAN_Interface::CAN_Interface(QObject *parent) : QObject(parent), m_canDevice(nullptr)
|
||||||
{
|
{
|
||||||
if (!QCanBus::instance()->plugins().contains(QStringLiteral("socketcan")))
|
if (!QCanBus::instance()->plugins().contains(QStringLiteral("socketcan")))
|
||||||
{
|
{
|
||||||
@@ -42,6 +42,8 @@ void CAN_Interface::connect_to_dev(QString dev)
|
|||||||
|
|
||||||
void CAN_Interface::send_frame(const QCanBusFrame frame)
|
void CAN_Interface::send_frame(const QCanBusFrame frame)
|
||||||
{
|
{
|
||||||
|
if (m_canDevice == nullptr)
|
||||||
|
return;
|
||||||
m_canDevice->writeFrame(frame);
|
m_canDevice->writeFrame(frame);
|
||||||
emit frame_send(frame);
|
emit frame_send(frame);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user