openplanet-nl / issues

Issue tracker for Openplanet.
10 stars 0 forks source link

globals that fail to initialize do not stop script execution #432

Closed ezio416 closed 6 months ago

ezio416 commented 6 months ago

If a variable is set globally (i.e. to make it a const) with a function and fails to do so for whatever reason (maybe due to the order of Openplanet's startup sequence), an exception is thrown but the plugin will continue to run anyway, causing numerous other exceptions when that variable is called later on. This seems to happen with GetApp() when the game boots, but reloading the plugin makes it work fine, and there are probably other things that can cause this. Not all functions will do this, i.e. UI::GetScale() can be called globally with no issues arising.

If a variable fails to initialize for any reason, the plugin should be stopped. Also, if GetApp() is used globally, a warning should be shown telling the developer not to do that.

codecat commented 6 months ago

Exceptions are now properly reported during global variable initialization and they will also cause plugin builds to fail.

image