mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-19 20:40: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
|
// Get a tiddler from the store
|
||||||
this.getTiddler = function(title) {
|
this.getTiddler = function(title) {
|
||||||
var t = tiddlers[title];
|
if(title) {
|
||||||
if(t instanceof $tw.Tiddler) {
|
var t = tiddlers[title];
|
||||||
return t;
|
if(t instanceof $tw.Tiddler) {
|
||||||
} else if(title !== undefined && Object.prototype.hasOwnProperty.call(shadowTiddlers,title)) {
|
return t;
|
||||||
return shadowTiddlers[title].tiddler;
|
} else if(title !== undefined && Object.prototype.hasOwnProperty.call(shadowTiddlers,title)) {
|
||||||
} else {
|
return shadowTiddlers[title].tiddler;
|
||||||
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user