Skip to content

Commit

Permalink
Added missing guard for non-objects on post.
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Jan 29, 2011
1 parent f78f9ce commit 8761b22
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/q.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ function ref(object) {
},
"post": function (name /*...args*/) {
var args = Array.prototype.slice.call(arguments, 1);
if (object === undefined || object === null)
return reject("" + object + " has no methods");
var method = object[name];
if (!method)
return reject("No such method " + name + " on object " + object);
Expand Down

0 comments on commit 8761b22

Please sign in to comment.