Null reference with conditional to go until not null