From 2aa6a6d998ed2f13e7a1bc79421f9d4356f5190e Mon Sep 17 00:00:00 2001 From: Zheng Chaoping Date: Wed, 11 Nov 2015 00:57:11 +0800 Subject: [PATCH] fs: return null error on readFile() success This commit ensures that readFile() callsback with a null error consistently on success. PR-URL: https://github.com/nodejs/node/pull/3740 Reviewed-By: Colin Ihrig Reviewed-By: Evan Lucas Reviewed-By: Sakthipriyan Vairamani --- lib/fs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fs.js b/lib/fs.js index 22e00c7030..8a0de7ccf1 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -405,7 +405,7 @@ function readFileAfterClose(err) { } function tryToString(buf, encoding, callback) { - var e; + var e = null; try { buf = buf.toString(encoding); } catch (err) {