CoderLine / alphaTab

alphaTab is a cross platform music notation and guitar tablature rendering library.
http://www.alphatab.net
Mozilla Public License 2.0
1.2k stars 198 forks source link

Xml Section parse error while some child tags may not exist #1556

Open allandiego opened 3 weeks ago

allandiego commented 3 weeks ago

Is there an existing issue for this?

Current Behavior

throws an error while trying to parse a gp file that have Section tag without a Letter child tag

TypeError: Cannot read properties of null (reading 'innerText')
 ❯ GpifParser.parseMasterBar importer/GpifParser.ts:1187:67
    1185|           case 'Section':
    1186|             masterBar.section = new Section();
    1187|             masterBar.section.marker = c.findChildElement('Letter')!.innerText;
       |                                                                   ^
    1188|             masterBar.section.text = c.findChildElement('Text')!.innerText;

Expected Behavior

Parse the gp file ignoring the non existence of the tag

Steps To Reproduce

try parse this gp file tab-example-1.zip

Link to jsFiddle, CodePen, Project

No response

Found in Version

1.4 (alpha)

Platform

Node.js

Environment

- **OS**: win 10 pro
- **Browser**: fire fox
- **.net Version**:

Anything else?

No response