Commit d6e203b2 authored by Tristan Cavelier's avatar Tristan Cavelier

query filtering crashes due to null document fixed

query.exec([{"title": "hello"}, null], {"select_list": "title"});
// before: TypeError: list[i] is null
// after: [{"title": "hello"}]
parent 0f6ab483
...@@ -954,7 +954,7 @@ Query.prototype.exec = function (item_list, option) { ...@@ -954,7 +954,7 @@ Query.prototype.exec = function (item_list, option) {
option.wildcard_character = '%'; option.wildcard_character = '%';
} }
while (i < item_list.length) { while (i < item_list.length) {
if (!this.match(item_list[i], option.wildcard_character)) { if (!item_list[i] || !this.match(item_list[i], option.wildcard_character)) {
item_list.splice(i, 1); item_list.splice(i, 1);
} else { } else {
i += 1; i += 1;
......
...@@ -79,7 +79,7 @@ Query.prototype.exec = function (item_list, option) { ...@@ -79,7 +79,7 @@ Query.prototype.exec = function (item_list, option) {
option.wildcard_character = '%'; option.wildcard_character = '%';
} }
while (i < item_list.length) { while (i < item_list.length) {
if (!this.match(item_list[i], option.wildcard_character)) { if (!item_list[i] || !this.match(item_list[i], option.wildcard_character)) {
item_list.splice(i, 1); item_list.splice(i, 1);
} else { } else {
i += 1; i += 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment