forked from osmocom/wireshark
Qt: Add null check for finfo and hfinfo
Adding the null check fixes a bug that made wireshark crash
when right clicking a subtree which doesn't have any preferences
and if none of the parents had one either.
The problem was introduced in commit 589413d877
Change-Id: Ia5bbae0a58298f3e9d912e44f33589da1cbfacc9
Reviewed-on: https://code.wireshark.org/review/29455
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
parent
04ef87a7b8
commit
7b37c5c180
|
@ -184,8 +184,9 @@ void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
|
|||
// The "text only" header field will not give preferences for the selected protocol.
|
||||
// Use parent in this case.
|
||||
proto_node *node = proto_tree_model_->protoNodeFromIndex(index).protoNode();
|
||||
while (node && node->finfo->hfinfo->id == hf_text_only)
|
||||
while (node && node->finfo && node->finfo->hfinfo && node->finfo->hfinfo->id == hf_text_only)
|
||||
node = node->parent;
|
||||
|
||||
FieldInformation pref_finfo(node);
|
||||
proto_prefs_menu_.setModule(pref_finfo.moduleName());
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ FieldInformation::FieldInformation(field_info *fi, QObject * parent)
|
|||
:QObject(parent)
|
||||
{
|
||||
fi_ = fi;
|
||||
parent_fi_ = 0;
|
||||
parent_fi_ = NULL;
|
||||
}
|
||||
|
||||
FieldInformation::FieldInformation(proto_node *node, QObject * parent)
|
||||
|
@ -34,7 +34,7 @@ bool FieldInformation::isValid() const
|
|||
|
||||
if ( fi_ && fi_->hfinfo )
|
||||
{
|
||||
if (fi_->hfinfo->blurb != 0 && fi_->hfinfo->blurb[0] != '\0') {
|
||||
if (fi_->hfinfo->blurb != NULL && fi_->hfinfo->blurb[0] != '\0') {
|
||||
ret = true;
|
||||
} else {
|
||||
ret = QString((fi_->hfinfo->name)).length() > 0;
|
||||
|
|
Loading…
Reference in New Issue