summaryrefslogtreecommitdiffstats
path: root/src/tools/uic/driver.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-03-22 17:39:49 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-04-14 00:04:26 +0200
commit4183fa4c0b75a76fbc687298f4513971a9230152 (patch)
tree4b73f3e9105467fff35ffcbd1e93c538b003046f /src/tools/uic/driver.cpp
parent2a7c71bef061d3d54e4de3cd4117e0998567028f (diff)
Tools: handle file opening failure
Most of the cases, a file handle (stdin/out) is opened without checking for error. That operation may still fail, so check for it. Change-Id: I30c3e7b40858acd8b1662622129bd6557722dccd Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/tools/uic/driver.cpp')
-rw-r--r--src/tools/uic/driver.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/uic/driver.cpp b/src/tools/uic/driver.cpp
index ab19f5a2b4..110764ee07 100644
--- a/src/tools/uic/driver.cpp
+++ b/src/tools/uic/driver.cpp
@@ -245,9 +245,10 @@ bool Driver::uic(const QString &fileName, DomUI *ui, QTextStream *out)
bool Driver::uic(const QString &fileName, QTextStream *out)
{
QFile f;
- if (fileName.isEmpty())
- f.open(stdin, QIODevice::ReadOnly);
- else {
+ if (fileName.isEmpty()) {
+ if (!f.open(stdin, QIODevice::ReadOnly))
+ return false;
+ } else {
f.setFileName(fileName);
if (!f.open(QIODevice::ReadOnly))
return false;