Skip to content

Player null check lost. #6599

Description

@class310

Steps to reproduce

When I'm playing a creative server, I open the creative inventory. When the mouse cursor hovers over an item, game crashed.

The crash report error line:

java.lang.NullPointerException: Cannot invoke "net.minecraft.client.player.LocalPlayer.getMainHandItem()" because "meteordevelopment.meteorclient.MeteorClient.mc.player" is null
at knot//meteordevelopment.meteorclient.utils.player.InvUtils.testInMainHand(InvUtils.java:42)
at knot//meteordevelopment.meteorclient.utils.player.InvUtils.testInHands(InvUtils.java:58)
at knot//meteordevelopment.meteorclient.systems.modules.player.AirPlace.onTick(AirPlace.java:88)
at knot//meteordevelopment.orbit.listeners.LambdaListener.call(LambdaListener.java:83)
at knot//meteordevelopment.orbit.EventBus.post(EventBus.java:53)

How to fix
Just add a

if (mc.player == null || mc.level == null) 
    return (for bool return:false, for void return: empty, for int return:-1/0);

Link to crash report/log (upload to https://mclo.gs and paste resulting link here)

Upper

Meteor Version

26.1.2-41

Minecraft Version

26.1.2

Operating System

Windows

Before submitting a crash report

  • This crash wasn't already reported (I have searched crash reports on GitHub).

  • This is a valid crash (I am able to reproduce this on the latest dev build).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions