[FIX] Avoid getting label by negative index #58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've not diagnosed rhe root cause; hopefully this points to it though.
With a query, "MATCH (s)-[r:incs]-(l:EC) WHERE ID(s)=3 RETURN r,l", which should be retrieving:
127.0.0.1:6379> GRAPH.QUERY G:1 "MATCH (s)-[r:incs]-(l:EC) WHERE ID(s)=3 RETURN r,l"
I instead get:
runtime error: index out of range [-2]
goroutine 210 [running]:
net/http.(*conn).serve.func1(0xc0002fc140)
/usr/lib/go-1.16/src/net/http/server.go:1824 +0x153
panic(0x9842e0, 0xc0014c04b0)
/usr/lib/go-1.16/src/runtime/panic.go:971 +0x499
github.com/redislabs/redisgraph-go.(*Graph).getLabel(0xc0018faea0, 0xfffffffffffffffe, 0x0, 0x0)
~/Dev/go/pkg/mod/github.com/redislabs/[email protected]+incompatible/graph.go:141 +0x152
github.com/redislabs/redisgraph-go.(*QueryResult).parseNode(0xc0017e5e00, 0x908040, 0xc00081adf8, 0x0)
~/Dev/go/pkg/mod/github.com/redislabs/[email protected]+incompatible/query_result.go:179 +0x219
github.com/redislabs/redisgraph-go.(*QueryResult).parseScalar(0xc0017e5e00, 0xc001461cc0, 0x2, 0x2, 0xc001461cc0, 0x2)
~/Dev/go/pkg/mod/github.com/redislabs/[email protected]+incompatible/query_result.go:257 +0x2b7
github.com/redislabs/redisgraph-go.(*QueryResult).parseRecords(0xc0017e5e00, 0xc0017d2d80, 0x3, 0x3)
~/Dev/go/pkg/mod/github.com/redislabs/[email protected]+incompatible/query_result.go:139 +0x434
github.com/redislabs/redisgraph-go.(*QueryResult).parseResults(0xc0017e5e00, 0xc0017d2d80, 0x3, 0x3)
~/Dev/go/pkg/mod/github.com/redislabs/[email protected]+incompatible/query_result.go:99 +0x77
github.com/redislabs/redisgraph-go.QueryResultNew(0xc0018faea0, 0x908040, 0xc00081aea0, 0xc0017d2d20, 0x3, 0x3)
~/Dev/go/pkg/mod/github.com/redislabs/[email protected]+incompatible/query_result.go:85 +0x1da
github.com/redislabs/redisgraph-go.(*Graph).Query(0xc0018faea0, 0xc0013cba80, 0x32, 0x7effa2628108, 0x40, 0xc0013cba80)
~/Dev/go/pkg/mod/github.com/redislabs/[email protected]+incompatible/graph.go:108 +0x171