Fix NPE after editing and not saving (close #10164)

Fix NPE
To test follow ticket's description https://trac.openmicroscopy.org.uk/ome/ticket/10164