fs: added an argument check in fs.watchFile
authorYoshihiro Kikuchi <yknetg@gmail.com>
Thu, 14 Jul 2011 06:14:44 +0000 (15:14 +0900)
committerBen Noordhuis <info@bnoordhuis.nl>
Thu, 21 Jul 2011 11:35:47 +0000 (13:35 +0200)
Fixes #1324.

lib/fs.js

index 29e1a3d..b907021 100644 (file)
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -629,6 +629,10 @@ fs.watchFile = function(filename) {
     listener = arguments[1];
   }
 
+  if (!listener) {
+    throw new Error('watchFile requires a listener function');
+  }
+
   if (options.persistent === undefined) options.persistent = true;
   if (options.interval === undefined) options.interval = 0;