hyOzd / serialplot

Small and simple software for plotting data from serial port in realtime.

Home Page:https://hackaday.io/project/5334-serialplot-realtime-plotting-software

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix for multiplot in snapshot

martijuerg opened this issue · comments

Multiplot in a snapshot is crashing because of access to PlotManager::_stream which is nullptr when PlotManger is used on a Snapshot. When adding a check for nullptr and we get nice multiplots in snapshots.

Patch:

diff -r a097738f33a7 src/plotmanager.cpp
--- a/src/plotmanager.cpp       Sun Dec 27 21:17:54 2020 +0300
+++ b/src/plotmanager.cpp       Sun Jan 03 10:53:45 2021 +0100
@@ -242,7 +242,10 @@
         {
             auto plot = addPlotWidget();
             plot->setVisible(curve->isVisible());
-            plot->setDispChannels(QVector<const StreamChannel*>(1, _stream->channel(i)));
+            if (_stream != nullptr)
+            {
+                plot->setDispChannels(QVector<const StreamChannel*>(1, _stream->channel(i)));
+            }
             curve->attach(plot);
             i++;
         }