diff --git a/cedar.go b/cedar.go index 645d089..23760c4 100644 --- a/cedar.go +++ b/cedar.go @@ -237,6 +237,10 @@ func (da *cedar) pushSibling(from, base int, label byte, hasChild bool) { c = &da.Ninfos[base^int(*c)].Sibling } } + // children must be different + if *c == label { + return + } da.Ninfos[base^int(label)].Sibling = *c *c = label }