Skip to content

Commit f8c7457

Browse files
authored
[NFC] Avoid potential null dereference. (#126872)
Add a null check.
1 parent e167c31 commit f8c7457

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Format/UnwrappedLineFormatter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ static auto computeNewlines(const AnnotatedLine &Line,
15961596
if (Line.startsWith(TT_NamespaceRBrace)) {
15971597
if (Style.WrapNamespaceBodyWithEmptyLines == FormatStyle::WNBWELS_Never)
15981598
Newlines = 1;
1599-
else if (!PreviousLine->startsWith(TT_NamespaceRBrace))
1599+
else if (PreviousLine && !PreviousLine->startsWith(TT_NamespaceRBrace))
16001600
Newlines = std::max(Newlines, 2u);
16011601
}
16021602
}

0 commit comments

Comments
 (0)