fix #23282: save selection without selection causes crash