From 6f2f5d25db4f9a674ca25e5b74caf518ecd38ff6 Mon Sep 17 00:00:00 2001 From: Soeren Apel Date: Fri, 3 Jul 2020 15:43:51 +0200 Subject: [PATCH] TabularDecView: Prevent a race condition When it occurs, section is -1 and we'd throw an exception. Catch the case instead and simply ignore it. --- pv/views/tabular_decoder/model.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pv/views/tabular_decoder/model.cpp b/pv/views/tabular_decoder/model.cpp index b87bf058..d85bf6aa 100644 --- a/pv/views/tabular_decoder/model.cpp +++ b/pv/views/tabular_decoder/model.cpp @@ -164,8 +164,11 @@ uint8_t AnnotationCollectionModel::first_hidden_column() const QVariant AnnotationCollectionModel::headerData(int section, Qt::Orientation orientation, int role) const { + if ((section < 0) || (section >= (int)header_data_.size())) + return QVariant(); + if ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole)) - return header_data_.at(section); + return header_data_[section]; return QVariant(); } -- 2.30.2