From 573fb94263f3f5e067b67bf43812e35c5e67008b Mon Sep 17 00:00:00 2001 From: Jithin Emmanuel Date: Mon, 2 Mar 2020 12:56:02 -0800 Subject: [PATCH] fix: test for response before accessing properties (#83) * fix: test for response before accessing properties * Update index.js --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 456a28c..a8053b2 100644 --- a/index.js +++ b/index.js @@ -239,7 +239,7 @@ class ExecutorQueue extends Executor { if (!err && response.statusCode === 201) { return resolve(response); } - if (response.statusCode !== 201) { + if (response && response.statusCode !== 201) { return reject(JSON.stringify(response.body)); } @@ -272,7 +272,7 @@ class ExecutorQueue extends Executor { return resolve(response); } - if (response.statusCode !== 200) { + if (response && response.statusCode !== 200) { return reject(JSON.stringify(response.body)); }