Skip to content

Commit 16aaf6c

Browse files
committed
Merge pull request #1029 from aroden-salesforce/issue_1028_fail_graceful_with_av
Fail gracefully when tree commit create fails
2 parents e6e98ba + 11c700d commit 16aaf6c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

LibGit2Sharp/TreeDefinition.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,12 @@ internal Tree Build(Repository repository)
310310
builtTreeEntryDefinitions.ForEach(t => entries[t.Item1] = t.Item2);
311311

312312
ObjectId treeId = builder.Write();
313-
return repository.Lookup<Tree>(treeId);
313+
var result = repository.Lookup<Tree>(treeId);
314+
if (result == null)
315+
{
316+
throw new LibGit2SharpException("Unable to read created tree");
317+
}
318+
return result;
314319
}
315320
}
316321

0 commit comments

Comments
 (0)