Am I missing something? The error message is saying pretty much what's wrong. Something in the if-statement is Null. Hover over the different variables (Insim.State I guess) and see if it's not Null.