[clangd] Add a missing early return in getTypeHierarchy()
authorNathan Ridge <zeratul976@hotmail.com>
Fri, 12 Jul 2019 00:24:45 +0000 (00:24 +0000)
committerNathan Ridge <zeratul976@hotmail.com>
Fri, 12 Jul 2019 00:24:45 +0000 (00:24 +0000)
Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64307

llvm-svn: 365849

clang-tools-extra/clangd/XRefs.cpp

index a596189..1d34499 100644 (file)
@@ -1230,6 +1230,8 @@ getTypeHierarchy(ParsedAST &AST, Position Pos, int ResolveLevels,
   RecursionProtectionSet RPSet;
   Optional<TypeHierarchyItem> Result =
       getTypeAncestors(*CXXRD, AST.getASTContext(), RPSet);
+  if (!Result)
+    return Result;
 
   if ((Direction == TypeHierarchyDirection::Children ||
        Direction == TypeHierarchyDirection::Both) &&