1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

no error when tiddler doesn't exist

Currently **tm-delete-tiddler** throws a red error box:

```
<$button>
<$action-sendmessage $message="tm-delete-tiddler" $param="DoesntExist"/>
delete non-existing
</$button>
```

**Uncaught TypeError: Cannot read property 'fields' of undefined**
This commit is contained in:
Tobias Beer 2015-02-09 12:28:42 +01:00
parent d340277cb2
commit ca6ab6388a

View File

@ -208,8 +208,11 @@ NavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) {
var title = event.param || event.tiddlerTitle,
tiddler = this.wiki.getTiddler(title),
storyList = this.getStoryList(),
originalTitle = tiddler.fields["draft.of"],
originalTitle = tiddler ? tiddler.fields["draft.of"] : 0,
confirmationTitle;
if(!tiddler) {
return false;
}
// Check if the tiddler we're deleting is in draft mode
if(originalTitle) {
// If so, we'll prompt for confirmation referencing the original tiddler