Accessed None error on IsValid node

Are we sure it’s not the other == blue wire that goes up up up that’s the culprit?

Hello

I’m putting together a system for hotkeys but I’ve ran into an access none error, the weird part is that it’s happening inside of an IsValid node so I’m not sure what’s happening or why.

I think it has something to do with the fact that I’m finding an item from a Map but I’m not too sure, could someone explain why the error is happening and possible steps to fix it?

Cheers!

344478-screenshot-3.jpg

Either the FIND is returning nothing, or this

344491-screenshot-1.jpg

is not defined. What you do to fix that really depends on what is happening here. We have no idea about that of course… :wink:

My bet is on the up up & away wire. isValid would catch the invalid slot before the Branch kicks in. The Branch does evaluate the ==, though.

FIND returns null and you access that return value, hence the error. You probably think you are checking the return value but you don’t, you are checking ItemInSlot which already requires you to access the returned null reference.

But isValid confirmed it’s not null… no?

Good point…

no, the result of FIND is never checked. If that result is null (which it probably is here) you try to access the member ItemInSlot of a nullptr object. There should be an IsValid node that directly checks the output of the FIND node, and only after that it is safe to access ItemInSlot.

From the branch inside the IsValid node, that why it says “… IsValid Node: Branch”. The branch you see in the screenshot is never reached.

The man’s right, it’s the branch inside the isValid that accesses null. Not sure how I missed that, embarrassing.

+1 internet point to you, sir/madam! And hats off.

True, but the error is coming from the branch statement.

GRIM YA is correct, when I changed the IsValid node to check the result of the find node it was in fact returning null, the code works without any errors now so I can begin to figure out what’s going wrong.

Cheers to all of you for helping!