aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2020-09-15 11:55:15 -0700
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2020-09-15 19:40:35 +0000
commit3426b25621f8ab37b93c96cb74ccc528175e34c5 (patch)
tree852e5c9b88759e88e236859b64b1bb761f78cad4 /ui
parent0c373d648a7f40405304a987701f59f8c2916cf5 (diff)
Qt: Make sure the packet diagram's FT_NONE label exists.
Gap items have a null field_info pointer, so set "Unknown" as the default representation string and fill it in after we've established that field_info is valid. Closes #16851.
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/packet_diagram.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/ui/qt/packet_diagram.cpp b/ui/qt/packet_diagram.cpp
index 1242479362..b10f1368c9 100644
--- a/ui/qt/packet_diagram.cpp
+++ b/ui/qt/packet_diagram.cpp
@@ -95,7 +95,7 @@ public:
FieldInformationGraphicsItem(field_info *fi, int start_bit, int fi_length, const DiagramLayout *layout, QGraphicsItem *parent = nullptr) :
QGraphicsPolygonItem(QPolygonF(), parent),
finfo_(new FieldInformation(fi)),
- representation(fi->rep->representation),
+ representation_("Unknown"),
start_bit_(start_bit),
layout_(layout),
collapsed_len_(fi_length),
@@ -173,6 +173,7 @@ public:
.arg(finfo_->headerInfo().abbreviation)
.arg(finfo_->toString()));
setData(Qt::UserRole, VariantPointer<field_info>::asQVariant(finfo_->fieldInfo()));
+ representation_ = fi->rep->representation;
} else {
setToolTip(QObject::tr("Gap in dissection"));
}
@@ -242,11 +243,11 @@ public:
// Field label(s)
QString label;
- if (finfo_->headerInfo().type == FT_NONE) {
- label = representation;
- } else {
- label = finfo_->headerInfo().name;
- }
+ if (finfo_->headerInfo().type == FT_NONE) {
+ label = representation_;
+ } else {
+ label = finfo_->headerInfo().name;
+ }
paintLabel(painter, label, scaled_tr_);
if (layout_->showFields()) {
@@ -264,7 +265,7 @@ private:
NumSpanMarks
};
FieldInformation *finfo_;
- QString representation;
+ QString representation_;
int start_bit_;
const DiagramLayout *layout_;
int collapsed_len_;