diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-03 14:46:53 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-05 14:47:55 +0200 |
commit | f1bb8dd4e9d5e65c48050ceb89edb9a8881a9114 (patch) | |
tree | 5072265cb68911bfaba8d80c21134f9ff607a616 /src | |
parent | 4270f5394ddd2415ddd17ea8e98f987841c8ce5e (diff) | |
download | justbuild-f1bb8dd4e9d5e65c48050ceb89edb9a8881a9114.tar.gz |
GitTree: Check optional before accessing it
... and drop unecessary IsTree() check.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/file_system/git_tree.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/buildtool/file_system/git_tree.cpp b/src/buildtool/file_system/git_tree.cpp index a369af78..c3aa92e7 100644 --- a/src/buildtool/file_system/git_tree.cpp +++ b/src/buildtool/file_system/git_tree.cpp @@ -44,10 +44,11 @@ namespace { return nullptr; } if (++it != end) { - if (not entry->IsTree()) { + auto const& subtree = entry->Tree(); + if (not subtree) { return nullptr; } - return LookupEntryPyPath(*entry->Tree(), it, end); + return LookupEntryPyPath(*subtree, it, end); } return entry; } |