Using boolean logic nodes with IsValid

Hello everybody,

I’m used to programming in C# in Unity, and a certain behaviour of Unreal is really bugging me:

I want to check if a variable is set, and if it is, further compare its attributes.

The problem with this setup is, that it gives me a ton of errors if TestVariable is null. Apparently it doesn’t break out of the OR-node after the first condition is met.

In Unity, I often did this:

if ((variable != null) && (variable.value == x))
//... do stuff

I was expecting the boolean logic blueprint nodes to work the same way, but instead Unreal seems to always check all conditions connected to the node.

So, could somebody tell me how I can get this to work properly?

the problem is that youre checking if its valid, and in the same branch checking the value. if its not valid than trying to check that value will always give you that error. instead do a branch checking isValid, then from the true part of the branch make a second branch checking the value

Thanks for your answer! Using two branches does works.
I would prefer a solution without a branch though, to be able to use it in pure functions.