diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-03-22 17:39:49 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-04-14 00:04:26 +0200 |
commit | 4183fa4c0b75a76fbc687298f4513971a9230152 (patch) | |
tree | 4b73f3e9105467fff35ffcbd1e93c538b003046f /src/tools/uic/uic.cpp | |
parent | 2a7c71bef061d3d54e4de3cd4117e0998567028f (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/uic.cpp')
-rw-r--r-- | src/tools/uic/uic.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index caf5ff4e1f..fb0a37d21d 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -38,9 +38,10 @@ bool Uic::printDependencies() QString fileName = opt.inputFile; 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; |