Is valid not working

I’ve been using ue4 for about a year now but nothing has been as frustrating as this. The is valid node, is what I use to check if a value is equal to null to prevent an accessed none error. The weird thing is, this time the error is complaing the “is valid” Boolean inside the macro is causing an accessed none error. Its so confusing to fix because if the reference is used an error is called, but if I check if its invalid an error is called for that? Please help me.

1 Like

that shouldn’t be happening, post screenshots of the error and you blueprint

Show code. Probably and issue in flow logic.

Sorry for the late reply. There’s two places this is causing issues one in an is valid and one in a is being destroyed. I want to fix this one first because it seems so simple. Basically just checking if index 0 of array is valid and being destroyed.

Regardless of which way I have the is valid index and being destroyed I always get this error.

Blueprint Runtime Error: “Attempted to access FirstPersonCharacter_C_1 via property CallFunc_Array_Get_Item, but FirstPersonCharacter_C_1 is pending kill”. Blueprint: MeetingWidget Function: Get Text 0 Graph: GetText_0 Node: Branch

The branch it is pointing to is the one circled in the image. In my mind it seems for some reason the is actor being destroyed is not working because it is being destroyed. ?

You could try this one:

1 Like

Thanks Egr, I have no idea why it worked but it did and now I only get one error, and I managed to fix that too by replacing the is actor being destroyed and the is valid macro to just the is valid Boolean. I might submit a bug report because it seems the is valid macro is bugged.

I can assure you it is not bugged. Is Actor being Destroyed is NOT safe to call on an object that is already destroyed. I can’t even think of a situation where a Blueprint needs to know if an object is about to be garbage collected.

You should always use the IsValid function or macro as it will always be safe to call even on Actors that are pending kill or garbage collected.