"Cannot read properties of null (reading 'src')" exception thrown when using alphaTab in Javascript module #666
Labels
platform-javascript
Related to the JavaScript version of alphaTab
state-accepted
This is a valid topic to work on.
type-improvement 🚀
Is there an existing issue for this?
Current Behavior
I'm trying to develop a toast UI editor plugin that uses alphaTex to visualize guitar tabs.
And I found that when I use alphaTab in a Javascript module,
I get an exception: "Cannot read properties of null (reading 'src')" when initializing alphaTab,
and then the initialization process is interrupted.
Expected Behavior
Because there's no "document.currentScript" in javascript module environment,
it would be safer to have null check on document.currentScript before returning document.currentScript.src.
So the initialization process won't be blocked due to the problem.
Steps To Reproduce
Link to jsFiddle, CodePen, Project
https://jsfiddle.net/yshlin/fo0pL65u/10/
Found in Version
1.2
Platform
Web
Environment
Anything else?
Still seeing the problem on the develop branch:
https://github.com/CoderLine/alphaTab/blob/develop/src/Environment.ts#L235
I was able to get my code to work after fixing this line.
The text was updated successfully, but these errors were encountered: