fix #41506 : crash on paste if a chordrest with spanner would cross a ba...

...rline

Updated also for the rest, since some spanners (e.g. slurs, hairpins) between a note and a rest are possible.