diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2015-11-24 15:10:21 +0100 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2015-11-24 15:45:02 +0000 |
commit | b3217e225fc14dd50a2a3848434da4e2131eefe9 (patch) | |
tree | 370846a09cfc60d9f82a4f6bff0fd86b30d908ea | |
parent | 40536512af1d52bd55f7d18cc9e370f7a40aad24 (diff) | |
download | wireshark-b3217e225fc14dd50a2a3848434da4e2131eefe9.tar.gz |
Qt: check that a file name was selected before trying to export follow content
Bug: 11763
Change-Id: Iab117fe9f572eccc3cf88a9f3ff86a22aa0e33c9
Reviewed-on: https://code.wireshark.org/review/12099
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
(cherry picked from commit 0981a50a57381fb33b010da791b7d82367b681cd)
Reviewed-on: https://code.wireshark.org/review/12102
-rw-r--r-- | ui/qt/follow_stream_dialog.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp index 5863381bae..35767e914a 100644 --- a/ui/qt/follow_stream_dialog.cpp +++ b/ui/qt/follow_stream_dialog.cpp @@ -220,22 +220,24 @@ void FollowStreamDialog::findText(bool go_back) void FollowStreamDialog::saveAs() { QString file_name = QFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Stream Content As" UTF8_HORIZONTAL_ELLIPSIS))); - file_.setFileName(file_name); - file_.open( QIODevice::WriteOnly ); - QTextStream out(&file_); + if (!file_name.isEmpty()) { + file_.setFileName(file_name); + file_.open( QIODevice::WriteOnly ); + QTextStream out(&file_); - save_as_ = true; + save_as_ = true; - readStream(); + readStream(); - if ((follow_info_.show_type != SHOW_RAW) && (follow_info_.show_type != SHOW_UTF8)) - { - out << ui->teStreamContent->toPlainText(); - } + if ((follow_info_.show_type != SHOW_RAW) && (follow_info_.show_type != SHOW_UTF8)) + { + out << ui->teStreamContent->toPlainText(); + } - save_as_ = false; + save_as_ = false; - file_.close(); + file_.close(); + } } void FollowStreamDialog::helpButton() |