From 9cc393b32864dc837ecfe47fd06e7afaffa72856 Mon Sep 17 00:00:00 2001 From: Elise Wood Date: Fri, 26 Feb 2010 15:25:09 +0800 Subject: [PATCH] don't die on null values --- mustache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 "\\\\";;