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

Attempting to set an invalid config option results in a crash. #368

Open
tehgreatdoge opened this issue Aug 18, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@tehgreatdoge
Copy link

Describe the bug
If you attempt to set the value of a config option that is nonexistent or not supported by the config.set method, it will result in a crash.

To Reproduce

  1. config.set("thisIsNotARealConfigOption", true)
    or
  2. config set showMountPrompt false

Expected behavior
A lua error will occur and be handleable by the user's code.

Environment (please complete the following information):

  • OS: Windows 10 Home
  • OS Version: 22H2
  • CraftOS-PC Version: v2.8.3
  • Compiled from source? No

Additional context
None

@tehgreatdoge tehgreatdoge added the bug Something isn't working label Aug 18, 2024
@MCJack123
Copy link
Owner

// If you're wondering why I'm using dynamic allocation for a static string that isn't needed past the end-of-scope,
// apparently there's some bug in the MSVC compiler's optimization that makes it sometimes try to delete static
// variables that a) are out of scope, and b) were never in scope. Of course, this results in a nasty crash due to
// trying to deallocate unallocated/invalid memory. The only workaround I've found is to make the static variables
// dynamic, thus telling MSVC to keep its grubby hands off allocation/deallocation. It's an unfortunate situation,
// but there's really no way around it.

It's probably related to this somehow. No idea why Windows decides to do these things! (For reference, this bug (properly) does not exist on other platforms.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants