[clang] [NFC] Avoid potential null dereference. (PR #126872)

via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 14 09:05:34 PST 2025


================
@@ -1596,7 +1596,7 @@ static auto computeNewlines(const AnnotatedLine &Line,
     if (Line.startsWith(TT_NamespaceRBrace)) {
       if (Style.WrapNamespaceBodyWithEmptyLines == FormatStyle::WNBWELS_Never)
         Newlines = 1;
-      else if (!PreviousLine->startsWith(TT_NamespaceRBrace))
+      else if (PreviousLine && !PreviousLine->startsWith(TT_NamespaceRBrace))
----------------
schittir wrote:

Thank you @HazardyKnusperkeks and @owenca - I've decided to revert this at present. 

https://github.com/llvm/llvm-project/pull/126872


More information about the cfe-commits mailing list