]> sigrok.org Git - pulseview.git/blobdiff - pv/views/tabular_decoder/model.cpp
TabularDecView: Fix invalid assert()
[pulseview.git] / pv / views / tabular_decoder / model.cpp
index 1d4d839e4757be2ad20169c09b621f04044013b1..28467de4a3424db932b06c5f32243e91b663cc4d 100644 (file)
@@ -130,10 +130,9 @@ QModelIndex AnnotationCollectionModel::index(int row, int column,
        const QModelIndex& parent_idx) const
 {
        (void)parent_idx;
-       assert(row >= 0);
        assert(column >= 0);
 
-       if (!dataset_)
+       if (!dataset_ || (row < 0))
                return QModelIndex();
 
        QModelIndex idx;
@@ -202,8 +201,7 @@ void AnnotationCollectionModel::set_signal_and_segment(data::DecodeSignal* signa
        } else {
                // Force the view associated with this model to update when we have more annotations
                if (prev_last_row_ < new_row_count) {
-                       dataChanged(index(prev_last_row_, 0, QModelIndex()),
-                               index(new_row_count, 0, QModelIndex()));
+                       dataChanged(index(prev_last_row_, 0), index(new_row_count, 0));
                        layoutChanged();
                }
        }
@@ -246,7 +244,7 @@ void AnnotationCollectionModel::update_annotations_without_hidden()
 
        all_annotations_without_hidden_.resize(count);
 
-       dataChanged(index(0, 0, QModelIndex()), index(count, 0, QModelIndex()));
+       dataChanged(index(0, 0), index(count, 0));
        layoutChanged();
 }