Null reference checks

I am having some problems with some code I have to spawn my player characters.

Specifically, this is a snippet of code that is checking which direction the player should be facing when they spawn.

if (CurrentLevelInfo.SpawnFacingLeft != null)
        if (CurrentLevelInfo.SpawnFacingLeft.Length >= desiredSpawnPoint) {
            if (CurrentLevelInfo.SpawnFacingLeft[desiredSpawnPoint])
                bFlipThePlayer = true;
        }

Now, most of the time I have no need nor desire to change what direction the player faces, so I have some code in there to make sure that the level info actually has this quality set. It is a simple array of bools, and it corresponds with the spawn points which is also set up in the same script.
But yet for some reason, it isn’t working. I have a line in there to check specifically if the array is long enough, but I still hit a null reference exception if the array doesn’t have any length. I even check is the array exists, but I still hit this exception when the length is zero. WTF? How am I supposed to check this without it stopping my code from executing?

Did you mean IndexOutOfRangeException?
You should check if the length is ’ > ', not ’ >= '.

Oh right, because length doesn’t start at zero. So when I checked for an index of zero I compared it to a length of zero.

Yeah, that fixed it. Thank you!