From 44fefdfa49eda743fb24169bf29859ad18943165 Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Fri, 27 Apr 2018 20:16:46 +0200 Subject: [PATCH] fix(Util): reject with a meaningful error instead of throwing one --- src/client/ClientDataResolver.js | 2 +- src/structures/interfaces/TextBasedChannel.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/ClientDataResolver.js b/src/client/ClientDataResolver.js index 0379cf5c5..56fae4c4c 100644 --- a/src/client/ClientDataResolver.js +++ b/src/client/ClientDataResolver.js @@ -271,7 +271,7 @@ class ClientDataResolver { }); } }); - } else if (resource.pipe && typeof resource.pipe === 'function') { + } else if (resource && resource.pipe && typeof resource.pipe === 'function') { return new Promise((resolve, reject) => { const buffers = []; resource.once('error', reject); diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index 7c03c9b98..6938d12b2 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -133,7 +133,7 @@ class TextBasedChannel { if (options.files) { for (let i = 0; i < options.files.length; i++) { let file = options.files[i]; - if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file }; + if (!file || typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file }; if (!file.name) { if (typeof file.attachment === 'string') { file.name = path.basename(file.attachment);