diff options
author | Peter Varga <[email protected]> | 2025-01-20 10:51:37 +0100 |
---|---|---|
committer | Peter Varga <[email protected]> | 2025-02-02 18:34:20 +0100 |
commit | 90fb632348ea5226a9aefd1e3707f112b80aa6b9 (patch) | |
tree | 55ed92b89381e8671452496ffbdba96caa8e86c2 /tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp | |
parent | ccff8d6d518c402759725723e34b5302fdbcf9e1 (diff) |
Fix discarded QFile::open() results
Also validate return value of QIODevice::open() and QBuffer::open()
calls.
Pick-to: 6.8 6.9
Change-Id: I71ea58f62cab5aafdd2b4eca217394dddf0033cd
Reviewed-by: Michal Klocek <[email protected]>
Reviewed-by: Moss Heim <[email protected]>
Diffstat (limited to 'tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp')
-rw-r--r-- | tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp index 1a4ee9c4b..1dfa94565 100644 --- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp +++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp @@ -359,7 +359,10 @@ private: static QString readFile(const QString &path) { QFile file(path); - file.open(QFile::ReadOnly); + if (!file.open(QFile::ReadOnly)) { + qWarning("Failed to read file %s: %s", qPrintable(path), qPrintable(file.errorString())); + return QString(); + } QByteArray contents = file.readAll(); file.close(); return contents; |