X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fdecodetrace.cpp;h=e14b4ecbf433469467c5b820eabf534aac04e1c7;hb=e352126139ca6ba64ef8bc0a4611cdb1c58c6a1b;hp=1d8c9b484d25fd560aa5a52b65de532c8fd75285;hpb=628b45cc0ba7ac38ac6a003fedbbc746f15dd724;p=pulseview.git diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp index 1d8c9b48..e14b4ecb 100644 --- a/pv/views/trace/decodetrace.cpp +++ b/pv/views/trace/decodetrace.cpp @@ -198,9 +198,11 @@ void DecodeTrace::paint_mid(QPainter &p, ViewItemPaintParams &pp) for (const Row& row : rows) { // Cache the row title widths int row_title_width; - try { - row_title_width = row_title_widths_.at(row); - } catch (out_of_range&) { + auto cached_width = row_title_widths_.find(row); + + if (cached_width != row_title_widths_.end()) + row_title_width = cached_width->second; + else { const int w = p.boundingRect(QRectF(), 0, row.title()).width() + RowTitleMargin; row_title_widths_[row] = w;