Load GPX files resulting in an error - bug report/ semi pull request
AdamSEY opened this issue · 1 comments
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
TypeError: Cannot read properties of null (reading 'getAttribute')
at GpifParser.parseDiagramItemForChord (node_modules/@coderline/alphatab/dist/alphaTab.js:10436:48)
at GpifParser.parseDiagramItemForTrack (node_modules/@coderline/alphatab/dist/alphaTab.js:10425:18)
at GpifParser.parseDiagramCollectionForTrack (node_modules/@coderline/alphatab/dist/alphaTab.js:10401:34)
at GpifParser.parseTrackProperty (node_modules/@coderline/alphatab/dist/alphaTab.js:10532:26)
at GpifParser.parseTrackProperties (node_modules/@coderline/alphatab/dist/alphaTab.js:10509:34)
at GpifParser.parseTrack (node_modules/@coderline/alphatab/dist/alphaTab.js:10029:34)
at GpifParser.parseTracksNode (node_modules/@coderline/alphatab/dist/alphaTab.js:9981:34)
at GpifParser.parseDom (node_modules/@coderline/alphatab/dist/alphaTab.js:9788:38)
at GpifParser.parseXml (node_modules/@coderline/alphatab/dist/alphaTab.js:9756:18)
at GpxImporter.readScore (node_modules/@coderline/alphatab/dist/alphaTab.js:12910:24)
at ScoreLoader.loadScoreFromBytes (/node_modules/@coderline/alphatab/dist/alphaTab.js:25670:38)
Expected Behavior
This GPX file is not being loaded on 1.3 or other versions. I attached the file.
Unreachable_hL2AcwtbG7.gpx.zip
Steps To Reproduce
I have added this line to this code and it seems like it solves the issue:
parseDiagramItemForChord(chord, node) {
chord.name = node.getAttribute('name');
let diagram = node.findChildElement('Diagram');
**if (!diagram) return;**
let stringCount = parseInt(diagram.getAttribute('stringCount'));
let baseFret = parseInt(diagram.getAttribute('baseFret'));
chord.firstFret = baseFret + 1;
Link to jsFiddle, CodePen, Project
No response
Found in Version
1.3-alpha
Platform
Node.js
Environment
- **OS**: Windows 11
- **Browser**:Chrome
Anything else?
No response
Thanks for reporting this. Seems there can be chords in the GP files without a "diagram" but only a name.