mirror of
https://github.com/loro-dev/loro.git
synced 2025-02-02 11:06:14 +00:00
fix: getting parent for root container error
This commit is contained in:
parent
c97f1eec58
commit
3ba8ad5f12
1 changed files with 6 additions and 0 deletions
|
@ -216,6 +216,12 @@ impl SharedArena {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_parent(&self, child: ContainerIdx) -> Option<ContainerIdx> {
|
pub fn get_parent(&self, child: ContainerIdx) -> Option<ContainerIdx> {
|
||||||
|
if self.get_container_id(child).unwrap().is_root() {
|
||||||
|
// TODO: PERF: we can speed this up by use a special bit in ContainerIdx to indicate
|
||||||
|
// whether the target is a root container
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
self.inner
|
self.inner
|
||||||
.parents
|
.parents
|
||||||
.lock()
|
.lock()
|
||||||
|
|
Loading…
Reference in a new issue