diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2019-05-22 22:13:30 +0200 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2019-05-24 16:18:25 +0000 |
commit | 29283decd7f312e54560cf53398a0809aac37803 (patch) | |
tree | aa14d4e0903e96c0c40ab3c0b532f72d1dc88aed | |
parent | f12ec0c9a36579e5d970207d601f98bc1d9e8c0e (diff) |
Qt: unchecked dynamic cast
Dynamic cast may yield NULL pointer, hence must be checked before
dereferencing it. Easy enough in a conditional.
CID 1435488
Change-Id: I8359ab5865795f1b1bea6980b023ff636d6719a6
Reviewed-on: https://code.wireshark.org/review/33316
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r-- | ui/qt/wlan_statistics_dialog.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/qt/wlan_statistics_dialog.cpp b/ui/qt/wlan_statistics_dialog.cpp index 4e84a401f7..3459b6f453 100644 --- a/ui/qt/wlan_statistics_dialog.cpp +++ b/ui/qt/wlan_statistics_dialog.cpp @@ -351,8 +351,8 @@ public: WlanStationTreeWidgetItem* receiver_ws_ti = NULL; foreach (QTreeWidgetItem *cur_ti, stations_) { WlanStationTreeWidgetItem *cur_ws_ti = dynamic_cast<WlanStationTreeWidgetItem *>(cur_ti); - if (cur_ws_ti->isMatch(&wlan_hdr->src)) sender_ws_ti = cur_ws_ti; - if (cur_ws_ti->isMatch(&wlan_hdr->dst)) receiver_ws_ti = cur_ws_ti; + if (cur_ws_ti && (cur_ws_ti->isMatch(&wlan_hdr->src))) sender_ws_ti = cur_ws_ti; + if (cur_ws_ti && (cur_ws_ti->isMatch(&wlan_hdr->dst))) receiver_ws_ti = cur_ws_ti; if (sender_ws_ti && receiver_ws_ti) break; } if (!sender_ws_ti) { |