diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp --- a/clang-tools-extra/clangd/SemanticHighlighting.cpp +++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -521,8 +521,8 @@ return std::nullopt; const auto *Tok = TB.spelledTokenAt(Loc); - assert(Tok); - + if (!Tok) + return std::nullopt; return halfOpenToRange(SourceMgr, Tok->range(SourceMgr).toCharRange(SourceMgr)); }