From 44dbae72bad1964936b626d8309d02002c665796 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Mon, 9 Mar 2015 14:19:37 -0700 Subject: 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 --- ui/qt/proto_tree.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ui/qt/proto_tree.cpp') 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(); - 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(); - 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(); + if (!fi || !fi->hfinfo) return; if(fi->hfinfo->type == FT_FRAMENUM) { #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) -- cgit v1.2.3