Skip to content

[1.21.1 NeoForge] Crash during initialization with MidnightLib installed - NullPointerException in MidnightConfig #101

Description

@exocyt0sis

Bug Description

The game crashes during initialization with a NullPointerException coming from MidnightConfig.writeChanges(String). This occurs when PackRepository.setSelected calls the Visual Overhaul mixin (handler$dpe000$visualoverhaul$setDefaultEnabledPacks).

It seems like Visual Overhaul is attempting to write to the config before MidnightLib has fully registered the mod's configuration map, resulting in a null lookup.

Steps to Reproduce

  1. Install Visual Overhaul for NeoForge 1.21.1.
  2. Install MidnightLib (version 1.9.3+1.21.1).
  3. Launch Minecraft.
  4. The game crashes on the "Initializing game" stage.

Environment

  • Minecraft Version: 1.21.1
  • Mod Loader: NeoForge (Loader version 4.0.42 / Modlauncher 11.0.5)
  • MidnightLib Version: 1.9.3+1.21.1
  • Visual Overhaul Version: Latest available for 1.21.1 NeoForge

Additional Context

  • Deleting the configuration files for Visual Overhaul did not resolve the issue.
  • The crash happens on the Render Thread during game setup.

Crash Report

java.lang.NullPointerException: Cannot invoke "eu.midnightdust.lib.config.MidnightConfig.writeChanges(String)" because the return value of "java.util.Map.get(Object)" is null
	at TRANSFORMER/midnightlib@1.9.3/eu.midnightdust.lib.config.MidnightConfig.write(MidnightConfig.java:241)
	at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.packs.repository.PackRepository.handler$dpe000$visualoverhaul$setDefaultEnabledPacks(PackRepository.java:530)
	at TRANSFORMER/minecraft@1.21.1/net.minecraft.server.packs.repository.PackRepository.setSelected(PackRepository.java:56)
	at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.Options.loadSelectedResourcePacks(Options.java:1554)
	at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.Minecraft.<init>(Minecraft.java:488)
	at TRANSFORMER/minecraft@1.21.1/net.minecraft.client.main.Main.main(Main.java:214)```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions