Check if the variable is defined before using it.