]> sigrok.org Git - pulseview.git/commitdiff
Session: Make sure we don't try to add a non-existant decoder
authorSoeren Apel <redacted>
Sat, 18 Mar 2017 11:12:41 +0000 (12:12 +0100)
committerSoeren Apel <redacted>
Wed, 22 Mar 2017 21:47:26 +0000 (22:47 +0100)
This can happen if either the saved configuration is wrong
or a decoder simply doesn't exist. We don't want to crash then.

pv/session.cpp

index fb7d6379c2a6af1b613e410b3f68e5e1239e1e52..0056e460b81ad92b2ef075bc43014914bd16ba3e 100644 (file)
@@ -620,6 +620,9 @@ const unordered_set< shared_ptr<data::SignalBase> > Session::signalbases() const
 #ifdef ENABLE_DECODE
 bool Session::add_decoder(srd_decoder *const dec)
 {
+       if (!dec)
+               return false;
+
        map<const srd_channel*, shared_ptr<data::SignalBase> > channels;
        shared_ptr<data::DecoderStack> decoder_stack;