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

Crash/Vanish when returning object with a field as null into a display panel. #22

Closed
FloralSoda opened this issue Dec 15, 2024 · 3 comments

Comments

@FloralSoda
Copy link

Issue type:

  • 🐛 Bug

Short description:

When returning a JSON object that has a field set to null, Gson cannot handle this field and throws an error. In a display panel, this usually results in a crash, but is sometimes error-handled as the display panel getting deleted.

Steps to reproduce the problem:

  1. Assemble a display panel, variable store, scripting drive and scripting terminal.
  2. Create a script with the following contents:
function bad_object() {
  let bad_obj = {};
  bad_obj["foo"] = null;
  return bad_obj;
}
  1. Create an operator variable card with this script.
  2. Apply0 the generated operator
  3. Put the new variable card into a display panel
  4. Game crash or display panel vanishes.

Expected behaviour:

I believe fields assigned null should be filtered out and ignored when converting a json object into nbt, though the exact behaviour of this may need discussion (null can be useful for communication between scripts, but doesn't really exist in NBT)


Versions:

  • This mod: IntegratedScripting 1.0.7
  • Minecraft: 1.21.1
  • Mod loader version: NeoForge 21.1.89

Log file:

https://gist.github.com/FloralSoda/a4e65e108424e83ae3d8ec993e138e73

@rubensworks
Copy link
Member

Thanks for reporting!

@kirjorjos
Copy link

Are you able to test easily if this happens in single player? I went to look at it in my dev environment and I'm unable to replicate the crash.

@FloralSoda
Copy link
Author

When I wrote this issue, I was testing it in singleplayer using just scripting and dynamics. The crashes seemed to happen most often when the script was run multiple times over multiple ticks, but it did still happen just 1 operation too

@github-project-automation github-project-automation bot moved this from To Do to Done in Maintenance Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants