summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2023-09-05 12:13:10 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-09-12 21:40:12 +0000
commit7e1321080c9bc1c779d9682bee8d95324a9878d1 (patch)
tree22d9ebad7abc2bf86c90c312ee5596ed085de16e
parent28ad12261c43ae795971ee76df7081daf441ed28 (diff)
syncqt: Add the missing is_open check to writeIfDifferent
Pick-to: 6.5 Change-Id: I2a969483d20f250083c1a262bd3bfc696a7f0df4 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> (cherry picked from commit a86fb92d4bc1a64703cabf351035efc861ea54dd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/tools/syncqt/main.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tools/syncqt/main.cpp b/src/tools/syncqt/main.cpp
index 5364606942..442d07a0a6 100644
--- a/src/tools/syncqt/main.cpp
+++ b/src/tools/syncqt/main.cpp
@@ -1760,6 +1760,10 @@ bool SyncScanner::writeIfDifferent(const std::string &outputFile, const std::str
memset(rdBuffer, 0, bufferSize);
std::ifstream ifs(outputFile, std::fstream::in);
+ if (!ifs.is_open()) {
+ std::cerr << "Unable to open " << outputFile << " for comparison." << std::endl;
+ return false;
+ }
std::streamsize currentPos = 0;
std::size_t bytesRead = 0;