Fix NPE after editing and not saving (close #10164)
Merge pull request #608 from jburel/npe-same-selection

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