fix #15721: Pasting selection including a line causes crash