Skip to content

Commit 435cb91

Browse files
committed
understand that null responses can be returned for the key/value array
and handle correctly
1 parent 2fc79bd commit 435cb91

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/search/lib/commands/SEARCH.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,14 @@ export type SearchRawReply = Array<any>;
7373
export function transformReply(reply: SearchRawReply, withoutDocuments: boolean): SearchReply {
7474
const documents = [];
7575
let i = 1;
76+
7677
while (i < reply.length) {
7778
documents.push({
78-
id: reply[i++],
79-
value: withoutDocuments ? Object.create(null) : documentValue(reply[i++])
79+
id: reply[i],
80+
value: withoutDocuments || reply[i+1] == null ? Object.create(null) : documentValue(reply[i+1])
8081
});
82+
83+
i += 2;
8184
}
8285

8386
return {

0 commit comments

Comments
 (0)