protect loop in/out from crash when empty score
fix #22452: Grace notes don't appear in part