Don't initialize max version if child doesn't exist

This commit is contained in:
2024-10-15 12:55:28 -07:00
parent 381fbce0c0
commit 5df25a138a

View File

@@ -1147,21 +1147,27 @@ ChildAndMaxVersion getChildAndMaxVersion(Node0 *, uint8_t) { return {}; }
ChildAndMaxVersion getChildAndMaxVersion(Node3 *self, uint8_t index) {
int i = getNodeIndex(self, index);
if (i < 0) {
return {};
ChildAndMaxVersion result;
result.child = nullptr;
return result;
}
return {self->children[i], self->childMaxVersion[i]};
}
ChildAndMaxVersion getChildAndMaxVersion(Node16 *self, uint8_t index) {
int i = getNodeIndex(self, index);
if (i < 0) {
return {};
ChildAndMaxVersion result;
result.child = nullptr;
return result;
}
return {self->children[i], self->childMaxVersion[i]};
}
ChildAndMaxVersion getChildAndMaxVersion(Node48 *self, uint8_t index) {
int i = self->index[index];
if (i < 0) {
return {};
ChildAndMaxVersion result;
result.child = nullptr;
return result;
}
return {self->children[i], self->childMaxVersion[i]};
}