Skip to content

Commit a329953

Browse files
committed
Fix 37800 - Check for FILTERS array before trying to OR two query objects
1 parent 40c86ef commit a329953

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

ClearBlade.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,18 @@ if (!window.console) {
843843
* //will match if an item has an attribute 'name' that is equal to 'John' or 'Jim'
844844
*/
845845
ClearBlade.Query.prototype.or = function (that) {
846-
for (var i = 0; i < that.query.FILTERS.length; i++) {
847-
this.query.FILTERS.push(that.query.FILTERS[i]);
846+
if (this.query.hasOwnProperty('FILTERS') && that.query.hasOwnProperty('FILTERS')) {
847+
for (var i = 0; i < that.query.FILTERS.length; i++) {
848+
this.query.FILTERS.push(that.query.FILTERS[i]);
849+
}
850+
return this;
851+
} else if (!this.query.hasOwnProperty('FILTERS') && that.query.hasOwnProperty('FILTERS')) {
852+
for (var j = 0; j < that.query.FILTERS.length; j++) {
853+
this.query.FILTERS = [];
854+
this.query.FILTERS.push(that.query.FILTERS[j]);
855+
}
856+
return this;
848857
}
849-
return this;
850858
};
851859

852860
/**

0 commit comments

Comments
 (0)