Skip to content

Commit 10adbaf

Browse files
committed
Hit a snafu when in the browser.
1 parent 5b0a268 commit 10adbaf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mustache.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,11 @@ var Mustache = function() {
164164
while(parts.length) {
165165
p = parts.shift();
166166
if(ctx[p] === undefined) {
167-
src = context.toSource();
168-
src = src.replace(/^\(|\)$/g, "");
167+
if(typeof(context.toSource) == "function") {
168+
src = context.toSource().replace(/^\(|\)$/g, "");
169+
} else {
170+
src = context.toString();
171+
}
169172
throw({message: "'" + name + "' not found in context: " + src});
170173
}
171174
ctx = ctx[p];

0 commit comments

Comments
 (0)