Sadly the js arguments object gives an arguments.length of 1 when
no arguments are passed, so we have to explicitly check for it.
// Do the dance for $.when()
return $.when.apply($, promises);
}).then(function() {
- // Undo the $.when() dance from arguments object into an array..
- var users = Array.prototype.slice.call(arguments);
+ var users = [];
+
+ // Determine if we've been passed any arguments..
+ if (arguments[0]) {
+ // Undo the $.when() dance from arguments object into an array..
+ users = Array.prototype.slice.call(arguments);
+ }
+
success(users);
}).catch(failure);
}