]> sigrok.org Git - pulseview.git/blobdiff - pv/views/tabular_decoder/model.cpp
TabularDecView: Try to handle a race condition in the model
[pulseview.git] / pv / views / tabular_decoder / model.cpp
index 110cfd62b98d2280acea700a1ce130a50eb5f5a3..b87bf05869ef1f118ad69853ff3899ec4e1d097a 100644 (file)
@@ -324,9 +324,9 @@ QModelIndex AnnotationCollectionModel::update_highlighted_rows(QModelIndex first
                // we would need to highlight - only then do we do so
                QModelIndex index = first;
                do {
-                       const Annotation* ann =
-                               static_cast<const Annotation*>(index.internalPointer());
-                       assert(ann);
+                       const Annotation* ann = static_cast<const Annotation*>(index.internalPointer());
+                       if (!ann)  // Can happen if the table is being modified at this exact time
+                               return result;
 
                        if (((int64_t)ann->start_sample() <= sample_num) &&
                                ((int64_t)ann->end_sample() >= sample_num)) {