Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some hscript crashes #16329

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Fix some hscript crashes #16329

wants to merge 3 commits into from

Conversation

Reycko
Copy link

@Reycko Reycko commented Feb 16, 2025

This PR fixes 2 crashes with HScript:

'Null Function Pointer' crash:

function onCountdownStarted()
{
  game.notes.thiswillcauseanerror(); // crash - null function pointer
}

'invalid field:' crash:

import flixel.FlxBasic;

function onCountdownStarted()
{
  var example = new FlxBasic();
  example.invalid = '123'; // crash - Invalid field:invalid
}

Fixes #16328

* Fix crash when calling invalid methods on class instances

* Fix crash when modifying invalid property or fields on class instances
Copy link
Contributor

@LarryFrosty LarryFrosty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you blawg 🙏 i couldn't figure out how to do this
i do have a recommendation for the invalid field access error
the error is really barebones, it doesn't even have the customized posInfos
i recommend you take the code from the first catch and copy it over to the second catch

@Reycko
Copy link
Author

Reycko commented Feb 20, 2025

Hi! I've commited a change that does what you requested

image

@LarryFrosty
Copy link
Contributor

Hi! I've commited a change that does what you requested

image

Nice but maybe remove funcToRun from the error message so that the function doesn't show up twice

@Reycko
Copy link
Author

Reycko commented Feb 20, 2025

This should be good. Thanks for taking your time with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HScript: Trying to call an invalid function in a class instance causes a crash
3 participants