From 8085f5bde39cb313bd70b6571495ceb5584e7ab8 Mon Sep 17 00:00:00 2001 From: Manuel Kraus Date: Sun, 7 Aug 2016 01:08:23 +0200 Subject: [PATCH] Fix data undefined error (#502) --- lib/Client/InternalClient.js | 2 +- src/Client/InternalClient.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index 0e193fd80..5416c6e7d 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -177,7 +177,7 @@ var InternalClient = (function () { ret.set('User-Agent', self.userAgentInfo.full); ret.end(function (error, data) { if (error) { - if (data.status === 429) { + if (data && data.status === 429) { self.client.emit("debug", "Encountered 429 at " + url + " | " + self.client.options.shard + " | Buckets" + buckets + " | " + (Date.now() - startTime) + "ms latency"); } reject(error); diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index e83f873b7..1adf56f2e 100755 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -107,7 +107,7 @@ export default class InternalClient { ret.set('User-Agent', self.userAgentInfo.full); ret.end((error, data) => { if (error) { - if(data.status === 429) { + if (data && data.status === 429) { self.client.emit("debug", "Encountered 429 at " + url + " | " + self.client.options.shard + " | Buckets" + buckets + " | " + (Date.now() - startTime) + "ms latency"); } reject(error);