From a7b806ec3a50684c1a3ac7066be6427c01f32e41 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Sun, 23 Apr 2023 17:53:37 +0800 Subject: [PATCH] fix: The cursor visited a invalid channel --- DSView/pv/view/dsosignal.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/DSView/pv/view/dsosignal.cpp b/DSView/pv/view/dsosignal.cpp index 407ec1bd..468608ae 100644 --- a/DSView/pv/view/dsosignal.cpp +++ b/DSView/pv/view/dsosignal.cpp @@ -1309,11 +1309,19 @@ void DsoSignal::paint_hover_measure(QPainter &p, QColor fore, QColor back) while (i != cursor_list.end()) { float pt_value; - const QPointF pt = get_point((*i)->index(), pt_value); + + int chan_index = (*i)->index(); + if (_data->has_data(chan_index) == false){ + i++; + continue; + } + + const QPointF pt = get_point(chan_index, pt_value); if (pt == QPointF(-1, -1)) { i++; continue; } + QString pt_str = get_voltage(hw_offset - pt_value, 2); const int pt_width = p.boundingRect(0, 0, INT_MAX, INT_MAX, Qt::AlignLeft | Qt::AlignTop, pt_str).width() + 10;