Skip to content

Commit f4c5d90

Browse files
autoantwortwinterz
authored andcommitted
Fixes #13962: fi can be nullptr (cppcheck-opensource#7623)
1 parent 1bf4505 commit f4c5d90

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

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)