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

[BUG] Index out of range #6

Closed
LdDl opened this issue Oct 28, 2021 · 0 comments · Fixed by #7
Closed

[BUG] Index out of range #6

LdDl opened this issue Oct 28, 2021 · 0 comments · Fixed by #7
Assignees
Labels

Comments

@LdDl
Copy link
Owner

LdDl commented Oct 28, 2021

Describe the bug
Got next error

panic: runtime error: index out of range [2] with length 0
goroutine 1 [running]:
main.main()
        D:/hp/go/pkg/mod/github.com/!ld!dl/osm2ch@v1.3.0/cmd/osm2ch/main.go:117 +0x1de5

To Reproduce
Just run in on random *.osm.pbf file

Expected behavior
This should not happen

Screenshots
nope

Desktop (please complete the following information):

  • Win10
  • 1.17
  • Public OSM

Additional context
I guess the error is in https://github.com/LdDl/osm2ch/blob/master/cmd/osm2ch/main.go#L117

if _, ok := verticesGeoms[source]; !ok {
verticesGeoms[source] = osm2ch.GeoPoint{Lon: expEdge.Geom[0].Lon, Lat: expEdge.Geom[0].Lat}
}
if _, ok := verticesGeoms[target]; !ok {
verticesGeoms[target] = osm2ch.GeoPoint{Lon: expEdge.Geom[2].Lon, Lat: expEdge.Geom[2].Lat}
}

We need to handle case when .expEdge.Geom has not points in it (actually < 2)

@LdDl LdDl added bug Something isn't working help wanted Extra attention is needed hacktoberfest hacktoberfest-2021 labels Oct 28, 2021
@LdDl LdDl self-assigned this Oct 28, 2021
@LdDl LdDl mentioned this issue Oct 28, 2021
@LdDl LdDl linked a pull request Oct 28, 2021 that will close this issue
@LdDl LdDl closed this as completed in #7 Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant