diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-07-08 16:19:19 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-07-08 23:20:03 +0000 |
commit | 131e0ab7ea461d519f0fbe80b03aa6bc99b9d452 (patch) | |
tree | b94a1cb63a5c6503d9e6426ea03121bb1b1b6637 /ui | |
parent | e312d418831c2f1cbb256584550b2c6ff765b7bc (diff) |
Handle setModule(NULL) more safely.
If module_name is null, we can't do much of anything - we don't have a
protocol ID, so we don't have a protocol.
Change-Id: I42c2fa4b47e39d7ac122c60be91b5d408bf30a1d
Reviewed-on: https://code.wireshark.org/review/9569
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/protocol_preferences_menu.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/ui/qt/protocol_preferences_menu.cpp b/ui/qt/protocol_preferences_menu.cpp index fca9e22909..81fd630a71 100644 --- a/ui/qt/protocol_preferences_menu.cpp +++ b/ui/qt/protocol_preferences_menu.cpp @@ -184,12 +184,9 @@ void ProtocolPreferencesMenu::setModule(const char *module_name) module_name_.clear(); module_ = NULL; - if (module_name) { - proto_id = proto_get_id_by_filter_name(module_name); - protocol = find_protocol_by_id(proto_id); - } - - if (proto_id < 0 || !protocol) { + if (!module_name || + (proto_id = proto_get_id_by_filter_name(module_name)) < 0 || + !(protocol = find_protocol_by_id(proto_id))) { action = addAction(tr("No protocol preferences available")); action->setDisabled(true); return; |