Closed kjsmita6 closed 9 years ago
are you sure that recAmt is an array of items?
I was fairly sure that's what backpack.filter returned, but I could be wrong. If it isn't an array, what is it?
Prepend console.log(recAmt) before the addItem call
See what you get
I get [] from that.
Here you go, array is empty, so you are passing an undefined element which has no properties and throw the error. Maybe you don't have any metal in your inventory? Or backpack.filter doesn't work as you thought. (Agree with Fiskie ↓)
Honestly, it seems you should be refactoring your code a bit - recAmt is a global variable here I assume? It can lead to unexpected behaviour when dealing with asynchronous environments like node.
I've fixed the issue by adding a few if/else statements. Thanks everyone for the help.
I made a bot which adds refined metal to trade when someone adds a key. So I added a key, and the bot crashed with this error.
I am not entirely sure what this error message means nor what the 'is_currency' property is. This is the code that cause the error:
Where 'recAmt' is
Any help would be appreciated. Thanks.