浏览代码

fix: bug修改

TIANYONG 11 月之前
父节点
当前提交
1190fd9f83
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/helpers/formateMusic.ts

+ 3 - 2
src/helpers/formateMusic.ts

@@ -969,9 +969,10 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			// } else {
 			// 	activeVerticalMeasureList = [note.sourceMeasure?.verticalMeasureList?.[0]] || [];
 			// }
+			
 			// 合并展示某些分轨,需要把展示的分轨筛选出来
 			if (state.isCombineRender && note.sourceMeasure.verticalMeasureList.length) {
-				note.sourceMeasure.verticalMeasureList = note.sourceMeasure?.verticalMeasureList.filter((item: any) => state.canSelectTracks.includes(item.parentStaff.parentInstrument.Name))
+				note.sourceMeasure.verticalMeasureList = note.sourceMeasure?.verticalMeasureList.filter((item: any) => state.canSelectTracks.includes(item?.parentStaff?.parentInstrument.Name))
 			}
 
 			activeVerticalMeasureList = [note.sourceMeasure?.verticalMeasureList?.[0]] || [];
@@ -982,7 +983,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			const vmLength = note.sourceMeasure?.verticalMeasureList?.length
 			let currentVmIndex = 0;
 			let hasSvgElement = currenrtVfVoices?.tickables[staveNoteIndex];
-			while (!hasSvgElement && vmLength > 1 && currentVmIndex <= vmLength - 1) {
+			while (!hasSvgElement && vmLength > 1 && currentVmIndex <= vmLength - 1 && currenrtVfVoices !== null) {
 				currentVmIndex += 1;
 				activeVerticalMeasureList = [note.sourceMeasure?.verticalMeasureList?.[currentVmIndex]] || [];
 				currenrtVfVoices = activeVerticalMeasureList[0]?.vfVoices['1'] ? activeVerticalMeasureList[0]?.vfVoices['1'] : activeVerticalMeasureList[0]?.vfVoices['2'] ? activeVerticalMeasureList[0]?.vfVoices['2'] : null;