fix #23648
fix #23282: save selection without selection causes crash