From 3a7e29674bc9223d0173ad49737f98ebab28d110 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 2 Jul 2015 17:33:51 +0100 Subject: [PATCH] Fix problem with checkbox widget and missing tiddlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The newly added invertTag code was crashing if the tiddler doesn’t exist. --- core/modules/widgets/checkbox.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/modules/widgets/checkbox.js b/core/modules/widgets/checkbox.js index cd6ff2045..c349fd4bb 100644 --- a/core/modules/widgets/checkbox.js +++ b/core/modules/widgets/checkbox.js @@ -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)) {