Fix problem with checkbox widget and missing tiddlers

The newly added invertTag code was crashing if the tiddler doesn’t
exist.
This commit is contained in:
Jermolene 2015-07-02 17:33:51 +01:00
parent 8b7aad11c0
commit 3a7e29674b
1 changed files with 4 additions and 3 deletions

View File

@ -95,11 +95,12 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
fallbackFields = {text: ""},
newFields = {title: this.checkboxTitle},
hasChanged = false,
tagCheck = false;
tagCheck = false,
hasTag = tiddler && tiddler.hasTag(this.checkboxTag);
if(this.checkboxTag && this.checkboxInvertTag === "yes") {
tagCheck = tiddler.hasTag(this.checkboxTag) === checked;
tagCheck = hasTag === checked;
} else {
tagCheck = tiddler.hasTag(this.checkboxTag) !== checked;
tagCheck = hasTag !== checked;
}
// Set the tag if specified
if(this.checkboxTag && (!tiddler || tagCheck)) {