Skip to content

Commit 06b490f

Browse files
authored
Fixes #13962: fi can be nullptr (danmar#7623)
1 parent ca83f56 commit 06b490f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/cppcheck.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,9 +2089,10 @@ unsigned int CppCheck::analyseWholeProgram(const std::string &buildDir, const st
20892089
// cppcheck-suppress shadowFunction - TODO: fix this
20902090
for (const Check *check : Check::instances()) {
20912091
if (checkClassAttr == check->name()) {
2092-
Check::FileInfo* fi = check->loadFileInfoFromXml(e);
2093-
fi->file0 = filesTxtInfo.sourceFile;
2094-
fileInfoList.push_back(fi);
2092+
if (Check::FileInfo* fi = check->loadFileInfoFromXml(e)) {
2093+
fi->file0 = filesTxtInfo.sourceFile;
2094+
fileInfoList.push_back(fi);
2095+
}
20952096
}
20962097
}
20972098
}

0 commit comments

Comments
 (0)