Fix warning about elementwise comparison to 'None'.