From d4e899c1e67b3e90e958ef0cf1b974617d5a90bb Mon Sep 17 00:00:00 2001 From: Mikael Karon Date: Thu, 21 Feb 2013 10:41:46 +0800 Subject: [PATCH] Be safer when using getargs --- src/weave.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/weave.js b/src/weave.js index 56bac55..95c887c 100644 --- a/src/weave.js +++ b/src/weave.js @@ -178,8 +178,10 @@ define([ "require", "jquery", "when", "troopjs-utils/getargs", "troopjs-utils/fi // Store trimmed matches[0] as WEAVE on attr_args attr_args[WEAVE] = matches[0].trim(); - // Transfer arguments from getargs - ARRAY_PUSH.apply(attr_args, getargs.call(matches[2])); + // Transfer arguments from getargs (if any exist) + if (matches[2]) { + ARRAY_PUSH.apply(attr_args, getargs.call(matches[2])); + } // Iterate end of attr_args to copy from $data for (i = 2, iMax = attr_args[LENGTH]; i < iMax; i++) {