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

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