-2
try {
    this.x = (int) Pc.INSTANCE.config.config.get(name + " x");
    this.y = (int) Pc.INSTANCE.config.config.get(name + " y");
    this.setEnabled((boolean) Pc.INSTANCE.config.config.get(name + " enabled"));
    } catch (NullPointerException e) {
        e.printStackTrace();
        this.x = x;
        this.y = y;
        this.enabled = true;
    }
    
    drag = new DraggableComponent(this.x, this.y, getWidth(), getHeight(), new Color(0, 0, 0, 0).getRGB());
}

And here is my error:

java.lang.NullPointerException: Cannot invoke "club.palmtrww.PC.util.config.Configuration.get(String)" because "club.palmtrww.PC.Pc.INSTANCE.config.config" is null
    at club.palmtrww.PC.hud.mod.HudMod.<init>(HudMod.java:26)
    at club.palmtrww.PC.hud.mod.impl.Keystrokes.<init>(Keystrokes.java:15)
    at club.palmtrww.PC.hud.mod.HudManager.<init>(HudManager.java:20)
    at club.palmtrww.PC.Pc.startup(Pc.java:31)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:570)
    at net.minecraft.client.Minecraft.run(Minecraft.java:405)
    at net.minecraft.client.main.Main.main(Main.java:113)
    at Start.main(Start.java:11)

If you need anymore files to fix the error please tell I've been stuck with this error for awhile and been trying to fix this

  • The error is self-descriptive Pc.INSTANCE.config.config is null, please double-check how you initialize it. – Berk Kurkcuoglu Jun 29 '21 at 19:43
  • Does this answer your question? [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – Filburt Jun 29 '21 at 20:04

1 Answers1

-2
try {
    this.x = (int) Pc.INSTANCE.config.config.get(name + " x");
    this.y = (int) Pc.INSTANCE.config.config.get(name + " y");
    this.setEnabled((boolean) Pc.INSTANCE.config.config.get(name + " enabled"));
    } catch (NullPointerException npe) {
        e.printStackTrace();
        this.x = x;
        this.y = y;
        this.enabled = true;
    }
    
    drag = new DraggableComponent(this.x, this.y, getWidth(), getHeight(), new Color(0, 0, 0, 0).getRGB());
}
Konstantinos K.
  • 181
  • 1
  • 9
  • What does this comment add? It doesn't compile and there is no additional info why this could be solve the topics owners problem. – Jasper Huzen Jun 29 '21 at 21:25