Skip to content

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

@FloralSoda

Description

@FloralSoda

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions