aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/follow_stream_dialog.cpp
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2016-05-22 19:44:25 +0200
committerMichael Mann <mmann78@netscape.net>2016-05-22 21:21:27 +0000
commit6a992182ce47d721ce73eabf99983cea480dcf97 (patch)
treed914b4bc54529da709410196c2cd8443d9295b07 /ui/qt/follow_stream_dialog.cpp
parentfc958817d15d2272bc18f8673e99ca91021ce507 (diff)
qt follow stream: don't crash when saving to an non-writable file
When the user clicks Save As in the Follow Stream window, check that the selected target file can be opened for writing. Bring up a warning box if the file is not writable. Change-Id: I76e67b064377dd432d3b14592f5096b99d9968c0 Reviewed-on: https://code.wireshark.org/review/15536 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/qt/follow_stream_dialog.cpp')
-rw-r--r--ui/qt/follow_stream_dialog.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp
index 443d10b0e9..29ec2b83fb 100644
--- a/ui/qt/follow_stream_dialog.cpp
+++ b/ui/qt/follow_stream_dialog.cpp
@@ -266,10 +266,14 @@ void FollowStreamDialog::saveAs()
{
QString file_name = QFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Stream Content As" UTF8_HORIZONTAL_ELLIPSIS)));
if (!file_name.isEmpty()) {
- file_.setFileName(file_name);
- file_.open(QIODevice::WriteOnly);
QTextStream out(&file_);
+ if (!file_.open(QIODevice::WriteOnly)) {
+ open_failure_alert_box(file_name.toUtf8().constData(), errno, TRUE);
+ return;
+ }
+ file_.setFileName(file_name);
+
save_as_ = true;
readStream();