From: Joel Holdsworth Date: Fri, 15 Mar 2013 19:42:40 +0000 (+0000) Subject: Tolerate unexpected packets rather than asserting X-Git-Tag: pulseview-0.1.0~81 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=79efbc53ba089330f407335f70f8e33dabf869b8;p=pulseview.git Tolerate unexpected packets rather than asserting --- diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index a611e7ac..5af04b83 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -29,6 +29,8 @@ #include +#include + using namespace boost; using namespace std; @@ -292,10 +294,15 @@ void SigSession::feed_in_meta(const sr_dev_inst *sdi, void SigSession::feed_in_logic(const sr_datafeed_logic &logic) { lock_guard lock(_data_mutex); - if (!_cur_logic_snapshot) + + if (!_logic_data) { - assert(_logic_data); + qDebug() << "Unexpected logic packet"; + return; + } + if (!_cur_logic_snapshot) + { // Create a new data snapshot _cur_logic_snapshot = shared_ptr( new data::LogicSnapshot(logic)); @@ -313,10 +320,15 @@ void SigSession::feed_in_logic(const sr_datafeed_logic &logic) void SigSession::feed_in_analog(const sr_datafeed_analog &analog) { lock_guard lock(_data_mutex); - if (!_cur_analog_snapshot) + + if(!_analog_data) { - assert(_analog_data); + qDebug() << "Unexpected analog packet"; + return; // This analog packet was not expected. + } + if (!_cur_analog_snapshot) + { // Create a new data snapshot _cur_analog_snapshot = shared_ptr( new data::AnalogSnapshot(analog));