String.IsNullOrEmpty stopped evaluating correctly

I have asked/encountered this problem before but am unsure what the fix was. I have an if statement that is using String.IsNullOrEmpty to evaluate a variable being null or empty. The variable I am passing in is empty, however it does not continue to the ‘Then’ part of the code. Instead, I get a “If: Object reference not set to an instance of an object” exception. Thanks in advance

Can I see your workflow?

it contains some technical data so I do not believe I can share it unfortunately

Is this how you have it set up? This is working for me when the string is null and when the string is empty.
image

1 Like

@jpreziuso

The default value of String is Nothing (a null reference). So it will not throw object reference error incase you are using a string variable in IF condition.

May i know the string value you’re using is a item from an array or other collections which may not initialized.

1 Like

Yes that is how I have it set up

Please make sure your variable is of type String.

The string value is not initialized. It is a variable coming from a database query

@jpreziuso could you try like this just once:
image

@jpreziuso

The value which you’re receiving from query is a plain string datatype or other datatype?

If possible can you share the screenshot of the if condition and variable declaration from variable panel.

The query gets a string and then passes that string to another variable. This string is empty (by choice) and not initialized to anything but the rest of the ‘if’ still does not evaluate