summaryrefslogtreecommitdiff
path: root/lib/timers.js
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-10-29 00:00:43 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-10-29 00:00:43 -0700
commit7a48fd845542c6ee36ebc42c8af731a66da9082e (patch)
treefe1659cd78a90dc8bb3341f93c567c5fa225bf10 /lib/timers.js
parentfa7dcbec8be1332f16e62675203598f4bb15645c (diff)
downloadnode-new-7a48fd845542c6ee36ebc42c8af731a66da9082e.tar.gz
Handle null values in clearTimeout
Diffstat (limited to 'lib/timers.js')
-rw-r--r--lib/timers.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/timers.js b/lib/timers.js
index b835ba5864..cb049b0333 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -209,9 +209,11 @@ exports.setTimeout = function (callback, after) {
exports.clearTimeout = function (timer) {
- timer.callback = timer._onTimeout = null;
- exports.unenroll(timer);
- if (timer instanceof Timer) timer.stop(); // for after === 0
+ if (timer) {
+ timer.callback = timer._onTimeout = null;
+ exports.unenroll(timer);
+ if (timer instanceof Timer) timer.stop(); // for after === 0
+ }
};