Qt: Handle cancel in import coloring rules
authorStig Bjørlykke <stig@bjorlykke.org>
Tue, 21 Feb 2017 12:18:55 +0000 (13:18 +0100)
committerStig Bjørlykke <stig@bjorlykke.org>
Tue, 21 Feb 2017 14:20:52 +0000 (14:20 +0000)
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>
ui/qt/coloring_rules_dialog.cpp

index fa6242f8e521ce2342519c231605ad7336963a99..d6cddc72d365f73509906498dcb42c57dd0a74f3 100644 (file)
@@ -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();