Skip to content

Commit

Permalink
fix: invalid memory address or nil pointer dereferenc when deleting r…
Browse files Browse the repository at this point in the history
…une key
  • Loading branch information
mohamedelhefni authored and dghubble committed Sep 20, 2024
1 parent 5e31374 commit 0b20e67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rune_trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func (trie *RuneTrie) Delete(key string) bool {
if node.isLeaf() {
// iterate backwards over path
for i := len(key) - 1; i >= 0; i-- {
if path[i].node == nil {
continue
}
parent := path[i].node
r := path[i].r
delete(parent.children, r)
Expand Down

0 comments on commit 0b20e67

Please sign in to comment.