]> sigrok.org Git - pulseview.git/commitdiff
DecodeSignal: Warn when the annotation class is invalid
authorSoeren Apel <redacted>
Mon, 30 Dec 2019 17:22:50 +0000 (18:22 +0100)
committerSoeren Apel <redacted>
Wed, 1 Jan 2020 14:05:05 +0000 (15:05 +0100)
pv/data/decodesignal.cpp

index a66e69d967b9fe7c54363da06e0f5703df6798e2..d976c494e2a74c88fce9aec39bf1bb983a470dce 100644 (file)
@@ -1411,7 +1411,12 @@ void DecodeSignal::annotation_callback(srd_proto_data *pdata, void *decode_signa
        assert(dec);
 
        AnnotationClass* ann_class = dec->get_ann_class_by_id(pda->ann_class);
-       assert(ann_class);
+       if (!ann_class) {
+               qWarning() << "Decoder" << ds->display_name() << "wanted to add annotation" <<
+                       "with class ID" << pda->ann_class << "but there are only" <<
+                       dec->ann_classes().size() << "known classes";
+               return;
+       }
 
        const Row* row = ann_class->row;