Issue Description
func (trie *Trie) compact() *Trie has a condition where child head is nil and causes nil pointer panic due to corrupted state or race condition.
Line of Code
// If any item is set, we cannot compact since we want to retain
// the ability to do searching by key. This makes compaction less usable,
// but that simply cannot be avoided.
if trie.item != nil || child.item != nil {
return trie
}
Proposed Mitigation
// If any item is set, we cannot compact since we want to retain
// the ability to do searching by key. This makes compaction less usable,
// but that simply cannot be avoided.
if child == nil || trie.item != nil || child.item != nil {
return trie
}
Simple and quick mitigation as a backdoor for such scenario
Issue Description
func (trie *Trie) compact() *Triehas a condition where child head is nil and causes nil pointer panic due to corrupted state or race condition.Line of Code
Proposed Mitigation
Simple and quick mitigation as a backdoor for such scenario