dareq112 Posted April 5, 2019 Report Share Posted April 5, 2019 Hello there, got some small problems in fetching item inspect link. I'm getting user inventory through getUserInventoryContents. When i get whole market_actions property it's working fine and giving me result with link and name. But when i try to get link property from market_actions, there's an error popping up "Cannot read property '0' of undefined". community.getUserInventoryContents("[U:1:884434522]", 730, 2, true, "polish", (err, inventory) => { if (err) { throw err; } for (let i=0; i<inventory.length; i++) { console.log(inventory[i].market_actions) // working console.log(inventory[i].market_actions[0].link) // not working Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted April 5, 2019 Report Share Posted April 5, 2019 Not every item is going to necessarily have market_actions. You need to check for each item to make sure that market_actions exists and isn't empty. dareq112 1 Quote Link to comment Share on other sites More sharing options...
dareq112 Posted April 6, 2019 Author Report Share Posted April 6, 2019 (edited) Thank you for the answer, now everything works smooth Edited April 6, 2019 by dareq112 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.