diff options
author | Tomasz Moń <desowin@gmail.com> | 2019-08-19 18:36:55 +0200 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2019-08-19 19:58:58 +0000 |
commit | 0fc5bf30a2daa7e3e0f1285ba808ebbe0625b54f (patch) | |
tree | 4e9bff8259f35b26f2741338db79ea6ddd326127 /ui | |
parent | 22b5495485b3359fd62a39bedf2251c48f411a87 (diff) |
Qt: Fix PacketListHeader dereferences before null check
Coverity CID 1446250, 14462554, 1446255, 1446256
Change-Id: I38ec9473dbee92a5bb3bc9635e2f6968db27b99e
Reviewed-on: https://code.wireshark.org/review/34325
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/widgets/packet_list_header.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/ui/qt/widgets/packet_list_header.cpp b/ui/qt/widgets/packet_list_header.cpp index f901d28570..a6a0bb0012 100644 --- a/ui/qt/widgets/packet_list_header.cpp +++ b/ui/qt/widgets/packet_list_header.cpp @@ -272,9 +272,15 @@ void PacketListHeader::doEditColumn() void PacketListHeader::doResolveNames() { QAction * action = qobject_cast<QAction *>(sender()); + if (!action) + return; + QMenu * menu = qobject_cast<QMenu *>(action->parent()); + if (!menu) + return; + PacketListModel * plmModel = qobject_cast<PacketListModel *>(model()); - if ( ! action || ! menu || ! plmModel ) + if (!plmModel) return; int section = menu->property("column").toInt(); @@ -288,8 +294,11 @@ void PacketListHeader::doResolveNames() void PacketListHeader::resizeToContent() { QAction * action = qobject_cast<QAction *>(sender()); + if (!action) + return; + QMenu * menu = qobject_cast<QMenu *>(action->parent()); - if (! action || ! menu) + if (!menu) return; int section = menu->property("column").toInt(); @@ -301,8 +310,11 @@ void PacketListHeader::resizeToContent() void PacketListHeader::removeColumn() { QAction * action = qobject_cast<QAction *>(sender()); + if (!action) + return; + QMenu * menu = qobject_cast<QMenu *>(action->parent()); - if (! action || ! menu) + if (!menu) return; int section = menu->property("column").toInt(); @@ -317,8 +329,11 @@ void PacketListHeader::removeColumn() void PacketListHeader::resizeToWidth() { QAction * action = qobject_cast<QAction *>(sender()); + if (!action) + return; + QMenu * menu = qobject_cast<QMenu *>(action->parent()); - if (! action || ! menu) + if (!menu) return; bool ok = false; |