Quantcast

plugin curScore variable null, not undefined when no score

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

plugin curScore variable null, not undefined when no score

Daniel Gibby
Most of the example plugins have the below 'undefined' check.

onRun: {
      console.log("Hello, testing.");

      if (typeof curScore === 'undefined') {
            Qt.quit();
      }
      console.log("Didn't quit: " + (typeof curScore));
      Qt.quit();
}



I closed all scores and ran the above, and this is the output:

Debug: Hello, testing.

Debug: Didn't quit: object


curScore is actually a null object.
It seems someone converted plugins from the old JavaScript and didn't update them to reflect what it should be instead:


if (curScore === null) {

Is this a bug that should be filed somewhere?

Thanks,
Daniel


------------------------------------------------------------------------------

_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: plugin curScore variable null, not undefined when no score

lasconic
Administrator
Hi,

Yes you can file the bug on the issue tracker https://musescore.org/en/project/issues
if you feel like it you can also create a fix and make a PR. Instructions to do so can be found here https://musescore.org/en/developers-handbook/git-workflow

lasconic

2015-09-13 1:29 GMT+02:00 Daniel Gibby <[hidden email]>:
Most of the example plugins have the below 'undefined' check.

onRun: {
      console.log("Hello, testing.");

      if (typeof curScore === 'undefined') {
            Qt.quit();
      }
      console.log("Didn't quit: " + (typeof curScore));
      Qt.quit();
}



I closed all scores and ran the above, and this is the output:

Debug: Hello, testing.

Debug: Didn't quit: object


curScore is actually a null object.
It seems someone converted plugins from the old JavaScript and didn't update them to reflect what it should be instead:


if (curScore === null) {

Is this a bug that should be filed somewhere?

Thanks,
Daniel


------------------------------------------------------------------------------

_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer



------------------------------------------------------------------------------

_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Loading...