From 6814cf4fa7c42a95417a52ddef4abedd554b300e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Tue, 21 Feb 2017 13:18:55 +0100 Subject: [PATCH] Qt: Handle cancel in import coloring rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I450cfc41d19c0dcb4aa59c0515d8d0834cfee60b Reviewed-on: https://code.wireshark.org/review/20223 Petri-Dish: Stig Bjørlykke Tested-by: Petri Dish Buildbot Reviewed-by: Jaap Keuter Reviewed-by: Stig Bjørlykke --- ui/qt/coloring_rules_dialog.cpp | 10 ++++++---- 1 file 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();