mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-17 03:20:02 +00:00
Fix problem with tiddler titled "undefined"
Fixes #2507 The problem stems from a JavaScript quirk: the fact that `({“undefined":"Me"})[undefined]` returns “Me”. The quirk is that the value `undefined` is coerced into the string “undefined” when used as an index. In this particular case, the code for `wiki.getTiddler()` was returning the tiddler with the title `”undefined”` when called with the title set to the value `undefined`. It happens that the pluginswitcher called `wiki.getTiddler(undefined)`.
This commit is contained in:
parent
487d6642e3
commit
e282ff1d92
13
boot/boot.js
13
boot/boot.js
@ -913,12 +913,13 @@ $tw.Wiki = function(options) {
|
||||
|
||||
// Get a tiddler from the store
|
||||
this.getTiddler = function(title) {
|
||||
var t = tiddlers[title];
|
||||
if(t instanceof $tw.Tiddler) {
|
||||
return t;
|
||||
} else if(title !== undefined && Object.prototype.hasOwnProperty.call(shadowTiddlers,title)) {
|
||||
return shadowTiddlers[title].tiddler;
|
||||
} else {
|
||||
if(title) {
|
||||
var t = tiddlers[title];
|
||||
if(t instanceof $tw.Tiddler) {
|
||||
return t;
|
||||
} else if(title !== undefined && Object.prototype.hasOwnProperty.call(shadowTiddlers,title)) {
|
||||
return shadowTiddlers[title].tiddler;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user