llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-format Author: None (schittir) <details> <summary>Changes</summary> Add a null check. --- Full diff: https://github.com/llvm/llvm-project/pull/126872.diff 1 Files Affected: - (modified) clang/lib/Format/UnwrappedLineFormatter.cpp (+1-1) ``````````diff diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index 46545aa1f4c07..a5b30c85974c7 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -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)) Newlines = std::max(Newlines, 2u); } } `````````` </details> https://github.com/llvm/llvm-project/pull/126872 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits