Add control to avoid NPE (see #10402)

Add control to avoid NPE
see https://trac.openmicroscopy.org.uk/ome/ticket/10402