-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed crash when handling an inventory issue #87
Conversation
``` /bots/node_modules/steamcommunity/components/users.js:265 callback(new Error(body.Error || "Malformed response")); ^ TypeError: Cannot read property 'Error' of undefined at Request._callback (/bots/node_modules/steamcommunity/components/users.js:265:28) at Request.self.callback (/bots/node_modules/steamcommunity/node_modules/request/request.js:199:22) at emitTwo (events.js:100:13) at Request.emit (events.js:185:7) at Request.<anonymous> (/bots/node_modules/steamcommunity/node_modules/request/request.js:1036:10) at emitOne (events.js:95:20) at Request.emit (events.js:182:7) at IncomingMessage.<anonymous> (/bots/node_modules/steamcommunity/node_modules/request/request.js:963:12) at emitNone (events.js:85:20) at IncomingMessage.emit (events.js:179:7) ```
The fix could be shortened to |
Yeah, but I was just trying to follow the already existing patterns. Either works. |
@@ -262,7 +262,12 @@ SteamCommunity.prototype.getUserInventory = function(userID, appID, contextID, t | |||
} | |||
|
|||
if(!body || !body.success || !body.rgInventory || !body.rgDescriptions || !body.rgCurrency) { | |||
callback(new Error(body.Error || "Malformed response")); | |||
if(body) { | |||
callback(new Error(body.error || "Malformed response")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's Error
, not error
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed.
Fixed crash when handling an inventory issue
👍 Thanks! |
This should fix a crash I've been occasionally experiencing, where
body
is undefined. The stack trace for this crash: