Skip to content

Commit c77eed5

Browse files
author
Leila Richardson-Noyes
committed
issue#181 - nil check
- Added cast error capture and nil check to loadDocument()
1 parent 67bd4f5 commit c77eed5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

redisearch/document.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ func loadDocument(arr []interface{}, idIdx, scoreIdx, payloadIdx, fieldsIdx int)
105105
}
106106

107107
if fieldsIdx > 0 {
108-
lst := arr[idIdx+fieldsIdx].([]interface{})
108+
lst, ok := arr[idIdx+fieldsIdx].([]interface{})
109+
if !ok && arr[idIdx+fieldsIdx] == nil {
110+
return doc, fmt.Errorf("document was nil")
111+
}
109112
doc.loadFields(lst)
110113
}
111114

0 commit comments

Comments
 (0)