diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-03-09 14:19:37 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-03-09 21:33:29 +0000 |
commit | 44dbae72bad1964936b626d8309d02002c665796 (patch) | |
tree | 08d315b38e0a2fc9589c999ef0da35582dcdc59d /ui/qt/proto_tree.cpp | |
parent | ae8b538bdf58ea92895bfdaf053a7f353f18a103 (diff) |
ProtoTree: Fix crashes.
Don't dereference a null pointer. Remove g_assert()s copied from ui/gtk.
This fixes problems mentioned in bug 11044 but not the bug itself.
Change-Id: Iab75ab5cc6a184c8145a094b1c529a634e3c1c0d
Ping-Bug: 11044
Reviewed-on: https://code.wireshark.org/review/7610
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/proto_tree.cpp')
-rw-r--r-- | ui/qt/proto_tree.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index c50a05fc93..94d84399be 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -361,7 +361,7 @@ void ProtoTree::expand(const QModelIndex & index) { field_info *fi; fi = index.data(Qt::UserRole).value<field_info *>(); - g_assert(fi); + if (!fi) return; if(prefs.gui_auto_scroll_on_expand) { ScrollHint scroll_hint = PositionAtTop; @@ -388,7 +388,7 @@ void ProtoTree::collapse(const QModelIndex & index) { field_info *fi; fi = index.data(Qt::UserRole).value<field_info *>(); - g_assert(fi); + if (!fi) return; /* * Nodes with "finfo->tree_type" of -1 have no ett_ value, and @@ -454,6 +454,7 @@ void ProtoTree::itemDoubleClick(QTreeWidgetItem *item, int column) { field_info *fi; fi = item->data(0, Qt::UserRole).value<field_info *>(); + if (!fi || !fi->hfinfo) return; if(fi->hfinfo->type == FT_FRAMENUM) { #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) |