Skip to content

Commit

Permalink
Fix dereferencing undefined after network error
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorMcKay committed Apr 11, 2024
1 parent 04f6058 commit ab18134
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/webapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit ab18134

Please sign in to comment.