redisearch-go icon indicating copy to clipboard operation
redisearch-go copied to clipboard

Prevent panic when lst (arr[idIdx+fieldsIdx]) is nil in loadDocument()

Open httpjamesm opened this issue 8 months ago • 1 comments

When using Search(), loadDocument is called where it loads fields and values through type casting. However, it doesn't do a nil check before casting arr[idIdx+fieldsIdx] into a []interface{}. Under specific circumstances without a comma ok check, the library will panic with the error panic: interface conversion: interface {} is nil, not []interface {}. This PR adds a comma ok check before casting lst to []interface{}.

httpjamesm avatar Oct 16 '23 21:10 httpjamesm