Hi, let’s say i have this blueprint array getter
Now it’s not mandatory that the
Options Bool array is filled, it could be empty with zero items.
Let’s say i now access the index
It returns false, which is my expected behaviour but it also throws a warning in the log
LogArray:Warning: Attempted to get an item from array OptionsBool out of bounds [1/0]!
It all works as expected and i don’t have any other error/warning but what should i do in this case?
Should i check if the array’s last index is equal/lower than my required index, like this?
To me it seems a little bit of overhead to do this but is it the “best practice” to keep the code clean or is this a warning that simply can be ignored?
Condition checking should not do much harm, better then making game write that message to log, you can turn that in to function if you like to look cleaner
Thx. I thought that maybe a better/faster way exist.
This is fine actually. It would not create much of an overhead unless you put this in a loop and run it thousands of times.
I’m having the same exact issue as well for my Inventory system on 4.14. If I go and manually add the array items for that variable then it fills my array up and I can’t really use it cause it thinks my inventory is filled. I tried resizing the variable array before adding items and doing other tricks but I still can’t figure out a smooth alternative.
For now everything works in game even though I get those log warnings but I agree and it does seem like it is something that needs to be optimized for best performance.