Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Commit

Permalink
Properly handle empty object in loadInventory
Browse files Browse the repository at this point in the history
Steam returns {} when GC is down.
  • Loading branch information
seishun committed Jan 22, 2014
1 parent bbb82ba commit 1114b57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ SteamTrade.prototype.loadInventory = function(appid, contextid, callback) {
uri: 'http://steamcommunity.com/my/inventory/json/' + appid + '/' + contextid,
json: true
}, function(error, response, body) {
if (error || response.statusCode != 200) {
this.emit('debug', 'loading my inventory: ' + (error || response.statusCode));
if (error || response.statusCode != 200 || JSON.stringify(body) == '{}') { // the latter happens when GC is down
this.emit('debug', 'loading my inventory: ' + (error || response.statusCode != 200 ? response.statusCode : '{}'));
this.loadInventory(appid, contextid, callback);
return;
}
Expand Down

0 comments on commit 1114b57

Please sign in to comment.