diff --git a/lib/q.js b/lib/q.js index 4236752e..18dbcffb 100644 --- a/lib/q.js +++ b/lib/q.js @@ -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);