From 3c901575b86c5cd3dbee09f1046fa0161d1be72c Mon Sep 17 00:00:00 2001 From: Yanis Benson Date: Sun, 7 Apr 2013 20:47:28 +0400 Subject: [PATCH] shouldCall now handles empty argument --- cupoftea.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cupoftea.js b/cupoftea.js index cc2333c..b310c3f 100644 --- a/cupoftea.js +++ b/cupoftea.js @@ -165,12 +165,14 @@ var Callbacks = function (runStack) { var oldRunStack = currentRunStack; currentRunStack = runStack; outstandingCallbacks.remove(callbackId); - try { - var result = f.apply(this, arguments); - } catch (e) { - results(e); - expectedExceptions.push(e); - throw e; + if(f){ + try { + var result = f.apply(this, arguments); + } catch (e) { + results(e); + expectedExceptions.push(e); + throw e; + } } if (outstandingCallbacks.isEmpty()) {