From 97d14ad3f80c2f755445411edf83f3b0fc12c660 Mon Sep 17 00:00:00 2001 From: Erik Kemperman Date: Thu, 13 Jul 2017 01:18:38 +0200 Subject: [PATCH] Update: Invoke callback with error or result, not both, when reading contents (#259) --- lib/src/read-contents/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/read-contents/index.js b/lib/src/read-contents/index.js index 81f263cc..5c3117d7 100644 --- a/lib/src/read-contents/index.js +++ b/lib/src/read-contents/index.js @@ -39,7 +39,10 @@ function readContents(optResolver) { // This is invoked by the various readXxx modules when they've finished // reading the contents. function onRead(readErr) { - callback(readErr, file); + if (readErr) { + return callback(readErr); + } + return callback(null, file); } }