# HG changeset patch # User Hasan Yavuz ÖZDERYA # Date 2019-01-22 09:22:16 # Node ID f2e074e1851504204324965fafaea588262487d6 # Parent 23909dc96af6da972271944aad426e611a6d493c fix crash on snapshot display diff --git a/src/plotmanager.cpp b/src/plotmanager.cpp --- a/src/plotmanager.cpp +++ b/src/plotmanager.cpp @@ -1,5 +1,5 @@ /* - Copyright © 2018 Hasan Yavuz Özderya + Copyright © 2019 Hasan Yavuz Özderya This file is part of serialplot. @@ -358,12 +358,24 @@ void PlotManager::_addCurve(QwtPlotCurve { // create a new plot widget plot = addPlotWidget(); - plot->setDispChannels(QVector(1, _stream->channel(index))); } else { plot = plotWidgets[0]; - plot->setDispChannels(_stream->allChannels()); + } + + if (_stream != nullptr) // not displaying snapshot + { + QVector dispChannels; + if (isMulti) + { + dispChannels = QVector(1, _stream->channel(index)); + } + else + { + dispChannels = _stream->allChannels(); + } + plot->setDispChannels(dispChannels); } // show the curve