summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2023-05-03 14:46:53 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2023-05-05 14:47:55 +0200
commitf1bb8dd4e9d5e65c48050ceb89edb9a8881a9114 (patch)
tree5072265cb68911bfaba8d80c21134f9ff607a616 /src
parent4270f5394ddd2415ddd17ea8e98f987841c8ce5e (diff)
downloadjustbuild-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.cpp5
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;
}