From ab18134c5ecca7bb599598699bedf04bebd6c82c Mon Sep 17 00:00:00 2001 From: Alex Corn Date: Thu, 11 Apr 2024 19:07:48 -0400 Subject: [PATCH] Fix dereferencing undefined after network error --- lib/webapi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/webapi.js b/lib/webapi.js index cb47972..8472344 100644 --- a/lib/webapi.js +++ b/lib/webapi.js @@ -38,14 +38,14 @@ TradeOfferManager.prototype._apiCall = function(httpMethod, method, version, inp this._community.httpRequest(options, (err, response, body) => { var error = err; - if (response.statusCode != 200 && !error) { + if (response && response.statusCode != 200 && !error) { error = new Error('HTTP error ' + response.statusCode); } if (error) { error.body = body; - if (typeof response.body === 'string' && response.body.indexOf('Access is denied') >= 0) { + if (response && typeof response.body === 'string' && response.body.indexOf('Access is denied') >= 0) { this._notifySessionExpired(error); }