Skip to content

get panic when iterator an empty trie #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tcp9 opened this issue Jan 28, 2019 · 3 comments
Closed

get panic when iterator an empty trie #6

tcp9 opened this issue Jan 28, 2019 · 3 comments

Comments

@tcp9
Copy link

tcp9 commented Jan 28, 2019

Hi:
this is the case

package main

import (
	"github.com/timtadh/data-structures/trie"
)

func main() {
	t := trie.New()
	for _, _, next := t.Iterate()(); next != nil; _, _, next = next() {

	}
}

golang version: go version go1.11.4 linux/amd64
when i'm using go run, it occurs

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x48ac3b]

goroutine 1 [running]:
github.com/timtadh/data-structures/trie.(*TST).Iterate.func1(0xc000067788, 0xc000090020, 0x0, 0x0, 0x0)
	/home/tcp9/go/src/github.com/timtadh/data-structures/trie/tst.go:215 +0x3b
main.main()
	/home/tcp9/go/src/test/test/main.go:9 +0x62
@timtadh
Copy link
Owner

timtadh commented Jan 29, 2019

Definitely looks like a bug. Will check it out.

@timtadh
Copy link
Owner

timtadh commented Jan 29, 2019

@tcp9 #7 should fix this for you. I am merging it.

@timtadh
Copy link
Owner

timtadh commented Jan 29, 2019

A release (https://github.com/timtadh/data-structures/releases/tag/v0.5.3) has been tagged. Please try updating to 0.5.3 (or master) and let me know if you are still having this problem.

@timtadh timtadh closed this as completed Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants