From: Soeren Apel Date: Mon, 30 Dec 2019 17:22:50 +0000 (+0100) Subject: DecodeSignal: Warn when the annotation class is invalid X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4526de63ae7ed0c3d1a708a84be16acbb9b62356;p=pulseview.git DecodeSignal: Warn when the annotation class is invalid --- diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index a66e69d9..d976c494 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -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;