diff --git a/mustache.js b/mustache.js index 6d7c8a1..e356521 100644 --- a/mustache.js +++ b/mustache.js @@ -194,7 +194,7 @@ var Mustache = function() { Does away with nasty characters */ escape: function(s) { - return s.toString().replace(/[&"<>\\]/g, function(s) { + return (s ? s.toString() : "").replace(/[&"<>\\]/g, function(s) { switch(s) { case "&": return "&"; case "\\": return "\\\\";;