MidnightLib icon indicating copy to clipboard operation
MidnightLib copied to clipboard

If a config file does not contain a list, Minecraft crashes upon an attempt to modify the list

Open KonSola5 opened this issue 1 year ago • 1 comments

Using MidnightLib 1.4.1-fabric.

To reproduce:

  1. Make a config with a string list.

  2. Launch the game and open the config screen.

  3. Try to insert something into the textbox.

  4. Crash due to UnsupportedOperationException.

  5. Launch Minecraft, but this time open the config screen and close it (so that the config file generates).

  6. Try to insert something into the textbox.

  7. Succeed.

Log: 2023-12-01-7.log

KonSola5 avatar Dec 01 '23 19:12 KonSola5

Current workaround: Add MidnightConfig.write("modid"); below the MidnightConfig.init("modid", ConfigFile.class) so that the config file is present and filled.

KonSola5 avatar Dec 01 '23 19:12 KonSola5

This seems like an issue on your side. You need to use an array list instead of a normal one, like this: public static List<String> listTest = new ArrayList<>();

Motschen avatar Aug 23 '24 14:08 Motschen

Alternatively, you can use Lists.newArrayList();

Motschen avatar Aug 23 '24 14:08 Motschen