mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-09 07:30:01 +00:00
Fix crash with search operator with blank field list
This commit is contained in:
parent
dff5315afe
commit
b584295831
@ -22,16 +22,18 @@ exports.search = function(source,operator,options) {
|
|||||||
return (operator.suffixes[1] || []).indexOf(flag) !== -1;
|
return (operator.suffixes[1] || []).indexOf(flag) !== -1;
|
||||||
},
|
},
|
||||||
excludeFields = false,
|
excludeFields = false,
|
||||||
firstChar = operator.suffixes[0][0].charAt(0),
|
fieldList = operator.suffixes[0] || [],
|
||||||
|
firstField = fieldList[0] || "",
|
||||||
|
firstChar = firstField.charAt(0),
|
||||||
fields;
|
fields;
|
||||||
if(operator.suffixes[0][0].charAt(0) === "-") {
|
if(firstChar === "-") {
|
||||||
fields = [operator.suffixes[0][0].slice(1)].concat(operator.suffixes[0].slice(1));
|
fields = [firstField.slice(1)].concat(fieldList.slice(1));
|
||||||
excludeFields = true;
|
excludeFields = true;
|
||||||
} else if(operator.suffixes[0][0] === "*"){
|
} else if(fieldList[0] === "*"){
|
||||||
fields = [];
|
fields = [];
|
||||||
excludeFields = true;
|
excludeFields = true;
|
||||||
} else {
|
} else {
|
||||||
fields = operator.suffixes[0].slice(0);
|
fields = fieldList.slice(0);
|
||||||
}
|
}
|
||||||
return options.wiki.search(operator.operand,{
|
return options.wiki.search(operator.operand,{
|
||||||
source: source,
|
source: source,
|
||||||
|
@ -1100,7 +1100,9 @@ exports.search = function(text,options) {
|
|||||||
if(options.field) {
|
if(options.field) {
|
||||||
if($tw.utils.isArray(options.field)) {
|
if($tw.utils.isArray(options.field)) {
|
||||||
$tw.utils.each(options.field,function(fieldName) {
|
$tw.utils.each(options.field,function(fieldName) {
|
||||||
fields.push(fieldName);
|
if(fieldName) {
|
||||||
|
fields.push(fieldName);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
fields.push(options.field);
|
fields.push(options.field);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user