]> sigrok.org Git - pulseview.git/commitdiff
Session: Don't process packets without sample data
authorSoeren Apel <redacted>
Sun, 8 Apr 2018 18:41:48 +0000 (20:41 +0200)
committerSoeren Apel <redacted>
Sun, 8 Apr 2018 18:41:48 +0000 (20:41 +0200)
pv/session.cpp

index bf9e3a2c0897973854223520fb37c1fae83018f7..cbf24e235acc274c478c79481bfc5b446c80939f 100644 (file)
@@ -1130,6 +1130,11 @@ void Session::feed_in_frame_end()
 
 void Session::feed_in_logic(shared_ptr<Logic> logic)
 {
+       if (logic->data_length() == 0) {
+               qDebug() << "WARNING: Received logic packet with 0 samples.";
+               return;
+       }
+
        if (!cur_samplerate_)
                cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);
 
@@ -1162,6 +1167,11 @@ void Session::feed_in_logic(shared_ptr<Logic> logic)
 
 void Session::feed_in_analog(shared_ptr<Analog> analog)
 {
+       if (analog->num_samples() == 0) {
+               qDebug() << "WARNING: Received analog packet with 0 samples.";
+               return;
+       }
+
        if (!cur_samplerate_)
                cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);