Skip to content

Commit 98a8d57

Browse files
amabluea-maurice
authored andcommitted
Fixed a potential null deref and added a unit test to catch that edge case.
PiperOrigin-RevId: 258265168
1 parent e99489a commit 98a8d57

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

database/src/desktop/core/operation.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ static Optional<Operation> OperationForChildAckUserWrite(
118118
return Optional<Operation>(op);
119119
} else {
120120
const Tree<bool>* child_tree = op.affected_tree.GetChild(child_key);
121-
return Optional<Operation>(Operation::AckUserWrite(
122-
Path(), *child_tree, op.revert ? kAckRevert : kAckConfirm));
121+
return Optional<Operation>(
122+
Operation::AckUserWrite(Path(), child_tree ? *child_tree : Tree<bool>(),
123+
op.revert ? kAckRevert : kAckConfirm));
123124
}
124125
}
125126

0 commit comments

Comments
 (0)