aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/coloring_rules_dialog.cpp
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2017-02-21 13:18:55 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2017-02-21 14:20:52 +0000
commit6814cf4fa7c42a95417a52ddef4abedd554b300e (patch)
treeee97a36c0da2613baa7bfb62fe2ed17be2a3a620 /ui/qt/coloring_rules_dialog.cpp
parent4b722f2e515750311606745a2807be70def6ed97 (diff)
Qt: Handle cancel in import coloring rules
Change-Id: I450cfc41d19c0dcb4aa59c0515d8d0834cfee60b Reviewed-on: https://code.wireshark.org/review/20223 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui/qt/coloring_rules_dialog.cpp')
-rw-r--r--ui/qt/coloring_rules_dialog.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/ui/qt/coloring_rules_dialog.cpp b/ui/qt/coloring_rules_dialog.cpp
index fa6242f8e5..d6cddc72d3 100644
--- a/ui/qt/coloring_rules_dialog.cpp
+++ b/ui/qt/coloring_rules_dialog.cpp
@@ -325,10 +325,12 @@ void ColoringRulesDialog::on_buttonBox_clicked(QAbstractButton *button)
if (button == import_button_) {
QString file_name = QFileDialog::getOpenFileName(this, wsApp->windowTitleString(tr("Import Coloring Rules")),
wsApp->lastOpenDir().path());
- gchar* err_msg = NULL;
- if (!color_filters_import(file_name.toUtf8().constData(), this, &err_msg, color_filter_add_cb)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg);
- g_free(err_msg);
+ if (!file_name.isEmpty()) {
+ gchar* err_msg = NULL;
+ if (!color_filters_import(file_name.toUtf8().constData(), this, &err_msg, color_filter_add_cb)) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg);
+ g_free(err_msg);
+ }
}
} else if (button == export_button_) {
int num_items = ui->coloringRulesTreeWidget->selectedItems().count();