From: Soeren Apel Date: Wed, 14 Jun 2017 21:37:18 +0000 (+0200) Subject: DecodeSignal: Don't assume channels always have logic data X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=04627946bb2377d8de2f4686a4ccef7eed6710cc;p=pulseview.git DecodeSignal: Don't assume channels always have logic data It could be that a signal was assigned to a decoder when it had a conversion enabled, then the conversion was removed. This means the signal may no longer provide logic data but as it's still assigned to the decoder, it will try to access the logic data and... boom. --- diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index 5701aeb0..e8206a08 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -181,6 +181,13 @@ void DecodeSignal::begin_decode() return; } + // Make sure that all assigned channels still provide logic data + // (can happen when a converted signal was assigned but the + // conversion removed in the meanwhile) + for (data::DecodeChannel &ch : channels_) + if (ch.assigned_signal && !(ch.assigned_signal->logic_data() != nullptr)) + ch.assigned_signal = nullptr; + // Check that all decoders have the required channels for (const shared_ptr &dec : stack_) if (!dec->have_required_channels()) {