I think you want to check these in the reverse order. If dns is nil, the zone method will crash afaict.