Skip to content

Commit 9e253b8

Browse files
[llvm-cas] Avoid crash when the provided CASID is not in CAS
Properly error out when the provided CASID is not in the CAS during `ls-tree-recursive` instead of crashing.
1 parent 8239934 commit 9e253b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/tools/llvm-cas/llvm-cas.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ int listTree(ObjectStore &CAS, const CASID &ID) {
200200
int listTreeRecursively(ObjectStore &CAS, const CASID &ID) {
201201
ExitOnError ExitOnErr("llvm-cas: ls-tree-recursively: ");
202202
TreeSchema Schema(CAS);
203+
ObjectProxy TreeN = ExitOnErr(CAS.getProxy(ID));
203204
ExitOnErr(Schema.walkFileTreeRecursively(
204-
CAS, *CAS.getReference(ID),
205+
CAS, TreeN.getRef(),
205206
[&](const NamedTreeEntry &Entry, Optional<TreeProxy> Tree) -> Error {
206207
if (Entry.getKind() != TreeEntry::Tree) {
207208
Entry.print(llvm::outs(), CAS);

0 commit comments

Comments
 (0)