From 1e4111a6ae0667f6249cfd89453423f00f713e48 Mon Sep 17 00:00:00 2001 From: Jesse Smick Date: Sat, 2 Nov 2013 11:53:59 -0700 Subject: [PATCH] Fix so passing an empty array as the message will not cause an error. --- lib/flash.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/flash.js b/lib/flash.js index a278bc1..095a9ed 100644 --- a/lib/flash.js +++ b/lib/flash.js @@ -65,8 +65,9 @@ function _flash(type, msg) { var args = Array.prototype.slice.call(arguments, 1); msg = format.apply(undefined, args); } else if (isArray(msg)) { + msgs[type] = msgs[type] || [] msg.forEach(function(val){ - (msgs[type] = msgs[type] || []).push(val); + msgs[type].push(val); }); return msgs[type].length; }