aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ng/timeout.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ng/timeout.js b/src/ng/timeout.js
index ac92bf8c..5b51f85e 100644
--- a/src/ng/timeout.js
+++ b/src/ng/timeout.js
@@ -70,12 +70,12 @@ function $TimeoutProvider() {
* Cancels a task associated with the `promise`. As a result of this the promise will be
* resolved with a rejection.
*
- * @param {Promise} promise Promise returned by the `$timeout` function.
+ * @param {Promise=} promise Promise returned by the `$timeout` function.
* @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
* canceled.
*/
timeout.cancel = function(promise) {
- if (promise.$$timeoutId in deferreds) {
+ if (promise && promise.$$timeoutId in deferreds) {
deferreds[promise.$$timeoutId].reject('canceled');
return $browser.defer.cancel(promise.$$timeoutId);
}