aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2019-11-21 12:35:29 +0100
committerRoland Knall <rknall@gmail.com>2019-11-21 12:05:56 +0000
commit59ce14522ba6f13d2877e8e37513031109adda16 (patch)
treeea0345772e66e52a0448a5e3e77e6ca36ab1b03e
parent5199a61e796ae10c036391d4f6c44fac1c4df18c (diff)
Qt: Fix nullpointer access
Due to changes with the frameSelect, this null pointer check now fails or more on the point is more obvious. It was masked previous Change-Id: I11c3f3440e39742bce963d1ef8bdd27076baa700 Reviewed-on: https://code.wireshark.org/review/35177 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
-rw-r--r--ui/qt/main_window_slots.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 4d8cd8368b..8d29ce6b8a 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -1160,7 +1160,6 @@ void MainWindow::setMenusForSelectedPacket()
<< main_ui_->actionViewColorizeConversation9 << main_ui_->actionViewColorizeConversation10;
if (capture_file_.capFile()) {
-
QList<int> rows = selectedRows();
frame_data * current_frame = 0;
if (rows.count() > 0)
@@ -1209,8 +1208,12 @@ void MainWindow::setMenusForSelectedPacket()
main_ui_->actionEditNextMark->setEnabled(another_is_marked);
main_ui_->actionEditPreviousMark->setEnabled(another_is_marked);
- main_ui_->actionEditPacketComment->setEnabled(frame_selected && wtap_dump_can_write(capture_file_.capFile()->linktypes, WTAP_COMMENT_PER_PACKET));
- main_ui_->actionDeleteAllPacketComments->setEnabled((capture_file_.capFile() != NULL) && wtap_dump_can_write(capture_file_.capFile()->linktypes, WTAP_COMMENT_PER_PACKET));
+ GArray * linkTypes = Q_NULLPTR;
+ if (capture_file_.capFile() && capture_file_.capFile()->linktypes)
+ linkTypes = capture_file_.capFile()->linktypes;
+
+ main_ui_->actionEditPacketComment->setEnabled(frame_selected && linkTypes && wtap_dump_can_write(capture_file_.capFile()->linktypes, WTAP_COMMENT_PER_PACKET));
+ main_ui_->actionDeleteAllPacketComments->setEnabled(linkTypes && wtap_dump_can_write(capture_file_.capFile()->linktypes, WTAP_COMMENT_PER_PACKET));
main_ui_->actionEditIgnorePacket->setEnabled(frame_selected || multi_selection);
main_ui_->actionEditIgnoreAllDisplayed->setEnabled(have_filtered);