summaryrefslogtreecommitdiffstats
path: root/src/plugins/canbus/peakcan/peakcanbackend.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2015-12-18 14:12:29 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-12-18 13:24:02 +0000
commit2bb7b51463767233e4490dd25433c6c183da9192 (patch)
tree59e4e305cc474fd7a5ad7f5d2600322fec9e137d /src/plugins/canbus/peakcan/peakcanbackend.cpp
parent8e8e27abaeb6fbf5bc9fdf6ca937aff74d21244c (diff)
Don't attempt to write an invalid QCanBusFrame
Change-Id: I9b73c9bdfe933a74302b4871aa40d5a025496b8c Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/plugins/canbus/peakcan/peakcanbackend.cpp')
-rw-r--r--src/plugins/canbus/peakcan/peakcanbackend.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/canbus/peakcan/peakcanbackend.cpp b/src/plugins/canbus/peakcan/peakcanbackend.cpp
index 41d8763..3bea3f0 100644
--- a/src/plugins/canbus/peakcan/peakcanbackend.cpp
+++ b/src/plugins/canbus/peakcan/peakcanbackend.cpp
@@ -517,6 +517,11 @@ bool PeakCanBackend::writeFrame(const QCanBusFrame &newData)
if (state() != QCanBusDevice::ConnectedState)
return false;
+ if (!newData.isValid()) {
+ setError(tr("Cannot write invalid QCanBusFrame"), QCanBusDevice::WriteError);
+ return false;
+ }
+
if (newData.frameType() != QCanBusFrame::DataFrame
&& newData.frameType() != QCanBusFrame::RemoteRequestFrame) {
setError(tr("Unable to write a frame with unacceptable type"),