CMake: Check result of file open

Change-Id: Ia4a11359f7cb08ee3fa55c77dc54d42890f37845
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Tobias Hunger
2016-11-29 14:57:14 +01:00
parent 2d8d90bc79
commit 49e255c4d5

View File

@@ -602,7 +602,8 @@ bool TeaLeafReader::extractFlagsFromMake(const CMakeBuildTarget &buildTarget,
makefile = makefile.remove("\\");
QFile file(makefile);
if (file.exists()) {
file.open(QIODevice::ReadOnly | QIODevice::Text);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
return false;
QTextStream stream(&file);
while (!stream.atEnd()) {
QString line = stream.readLine().trimmed();
@@ -659,7 +660,8 @@ bool TeaLeafReader::extractFlagsFromNinja(const CMakeBuildTarget &buildTarget,
buildNinjaFile += "/build.ninja";
QFile buildNinja(buildNinjaFile);
if (buildNinja.exists()) {
buildNinja.open(QIODevice::ReadOnly | QIODevice::Text);
if (!buildNinja.open(QIODevice::ReadOnly | QIODevice::Text))
return false;
ninjaFile = buildNinja.readAll();
buildNinja.close();
}