fix #24409: crash when adding lyrics

or staff- or system text.
Using the change from PR #666 and additionaly reverting one line back to
what it was before commit 95bf389ff.