Fix NPE when opening masking tool in particular