Commit 2206561
committed
fix(importer): use explicit bounds check for masterBars access
The previous masterBar lookup used `score.masterBars[barNumber]` with
an `| undefined` type and an `if (!masterBar)` guard. That relies on
JS array out-of-bounds returning undefined — not C# / Kotlin
transpilation compatible, since the indexed access there throws
IndexOutOfRangeException / IndexOutOfBoundsException before the
undefined-check has a chance to run.
Replace with an explicit `barNumber < 0 || barNumber >= length` guard
before the access, matching the idiom already used 9 lines above for
sustain-pedal markers (GpifParser.ts) and in Gp3To5Importer.ts:508.
Addresses review feedback from @Danielku15 on PR #2668.1 parent f5e2fff commit 2206561
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2892 | 2892 | | |
2893 | 2893 | | |
2894 | 2894 | | |
2895 | | - | |
2896 | | - | |
| 2895 | + | |
2897 | 2896 | | |
2898 | 2897 | | |
2899 | 2898 | | |
| 2899 | + | |
2900 | 2900 | | |
2901 | 2901 | | |
2902 | 2902 | | |
| |||
0 commit comments