Skip to content

Commit 9a5c448

Browse files
committed
[clangd] Fix null check in FindTarget.
I've hit this stack trace a few times but don't have a good reproducer. The code is unsafe by inspection, though.
1 parent d966bf8 commit 9a5c448

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ struct TargetFinder {
231231
}
232232

233233
void add(const Decl *Dcl, RelSet Flags) {
234-
const NamedDecl *D = llvm::dyn_cast<NamedDecl>(Dcl);
234+
const NamedDecl *D = llvm::dyn_cast_or_null<NamedDecl>(Dcl);
235235
if (!D)
236236
return;
237237
debug(*D, Flags);

0 commit comments

Comments
 (0)