Animated-Java / animated-java

A Blockbench plugin that makes complex animation a breeze in Minecraft: Java Edition.
Other
159 stars 26 forks source link

[BUG] `useNbt: true` with an empty NBT string causes an error when you try to export. #194

Closed TheAfroOfDoom closed 3 months ago

TheAfroOfDoom commented 3 months ago

Describe the bug useNbt: true with an empty NBT string causes an error when you try to export.

To Reproduce Steps to reproduce the behavior:

  1. Create a bone
  2. Set Use NBT to true in the bone config
  3. Click confirm (leave the NBT field empty)
  4. Export model
  5. See error

Expected behavior

Two things:

  1. Gracefully handle an empty string (defaulting to "{}" probably)
  2. Output a more meaningful error message / run NBT/JSON validation on the input early

Error Message

Expected value at position 0: <--[HERE]
Error: Expected value at position 0: <--[HERE]
    at Us.createError (<anonymous>:5961:142)
    at Object.readTag (<anonymous>:5964:4363)
    at NbtCompound.fromString (<anonymous>:5967:343)
    at NbtTag.fromString (<anonymous>:5961:51288)
    at $t.toNBT (<anonymous>:5967:153001)
    at hashRig (<anonymous>:6842:19685)
    at actuallyExportProject (<anonymous>:6842:22321)
    at async exportProject (<anonymous>:6847:68)

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context