Fix dfsprev

This commit is contained in:
mcrakhman 2022-12-03 15:59:45 +01:00 committed by Mikhail Iudin
parent 8735700514
commit 2ba8108292
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0

View File

@ -336,8 +336,9 @@ func (t *Tree) dfsPrev(stack []*Change, breakpoints []string, visit func(ch *Cha
t.visitedBuf = append(t.visitedBuf, ch)
for _, prevId := range ch.PreviousIds {
prevCh := t.attached[prevId]
if !prevCh.visited {
prevCh, exists := t.attached[prevId]
// here the only time it wouldn't exist if we are at the tree root
if exists && !prevCh.visited {
stack = append(stack, prevCh)
}
}