]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decodesignal.cpp
DecodeSignal: Warn when the annotation class is invalid
[pulseview.git] / 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(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;
 
 
        const Row* row = ann_class->row;