Skip to content
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

Crash from maptile/tilecover/polygon.go #55

Closed
glagnar opened this issue Oct 21, 2020 · 2 comments
Closed

Crash from maptile/tilecover/polygon.go #55

glagnar opened this issue Oct 21, 2020 · 2 comments

Comments

@glagnar
Copy link

glagnar commented Oct 21, 2020

I am getting a crash from the library - it seems the intersections array can have an uneven number of elements.

panic: runtime error: index out of range [305] with length 305

goroutine 1 [running]:
github.com/paulmach/orb/maptile/tilecover.polygon(0xc000090810, 0xc0000a66c0, 0x1, 0x1, 0x19)
	/Users/tgilbert/code/go/src/github.com/paulmach/orb/maptile/tilecover/polygon.go:82 +0x445
github.com/paulmach/orb/maptile/tilecover.Polygon(...)
	/Users/tgilbert/code/go/src/github.com/paulmach/orb/maptile/tilecover/polygon.go:22
github.com/paulmach/orb/maptile/tilecover.Geometry(0x113a220, 0xc0000a6980, 0x19, 0xc0000a6980)
	/Users/tgilbert/code/go/src/github.com/paulmach/orb/maptile/tilecover/helpers.go:29 +0xf0
github.com/alexandrainst/agentlogic.(*Mission).GeneratePath(0xc0000cfad0, 0x11123d0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/tgilbert/code/go/src/github.com/alexandrainst/agentlogic/mission.go:188 +0x9e
main.main()
	/Users/tgilbert/code/go/src/github.com/alexandrainst/agentlogic/examples/main.go:72 +0x9c5
@paulmach
Copy link
Owner

Okay, I was able to duplicate using the code in your https://github.com/alexandrainst/agentlogic repo. I will look.

@paulmach
Copy link
Owner

This is because the rings of your polygons where not closed (start and end point the same). I update it so there is still a panic with a nicer error message.

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