aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/WhitespaceManager.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2024-03-24 15:22:40 -0700
committerGitHub <noreply@github.com>2024-03-24 15:22:40 -0700
commitcceedc939a43c7c732a5888364251775bffc2dba (patch)
treecae065ab29e4e5e01f0716ce700d0ce1148dd30b /clang/lib/Format/WhitespaceManager.cpp
parent67f2267ae006f35edfdf36567646403e61527d1b (diff)
downloadllvm-cceedc939a43c7c732a5888364251775bffc2dba.zip
llvm-cceedc939a43c7c732a5888364251775bffc2dba.tar.gz
llvm-cceedc939a43c7c732a5888364251775bffc2dba.tar.bz2
[clang-format] Fix a crash with AlignArrayOfStructures option (#86420)
Fixes #86109.
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.cpp')
-rw-r--r--clang/lib/Format/WhitespaceManager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index fef85ab..710bf8d 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -1491,7 +1491,7 @@ WhitespaceManager::CellDescriptions WhitespaceManager::getCells(unsigned Start,
: Cell);
// Go to the next non-comment and ensure there is a break in front
const auto *NextNonComment = C.Tok->getNextNonComment();
- while (NextNonComment->is(tok::comma))
+ while (NextNonComment && NextNonComment->is(tok::comma))
NextNonComment = NextNonComment->getNextNonComment();
auto j = i;
while (j < End && Changes[j].Tok != NextNonComment)