Skip to content

Commit 395da75

Browse files
committed
[clang-tidy] Fix bugprone-unchecked-optional-access in FunctionSizeCheck
1 parent 83e4eff commit 395da75

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clang-tools-extra/clang-tidy/readability/FunctionSizeCheck.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,12 @@ void FunctionSizeCheck::check(const MatchFinder::MatchResult &Result) {
225225
<< ActualNumberParameters << ParameterThreshold.value();
226226
}
227227

228-
for (const auto &CSPos : FI.NestingThresholders) {
229-
diag(CSPos, "nesting level %0 starts here (threshold %1)",
230-
DiagnosticIDs::Note)
231-
<< NestingThreshold.value() + 1 << NestingThreshold.value();
228+
if (NestingThreshold) {
229+
for (const auto &CSPos : FI.NestingThresholders) {
230+
diag(CSPos, "nesting level %0 starts here (threshold %1)",
231+
DiagnosticIDs::Note)
232+
<< NestingThreshold.value() + 1 << NestingThreshold.value();
233+
}
232234
}
233235

234236
if (VariableThreshold && FI.Variables > VariableThreshold) {

0 commit comments

Comments
 (0)