Skip to content

Fixed crash when editingLandmark is null - #26

Merged
sleepingdragoninn merged 1 commit into
HestiMae:1.20from
Nico44YT:1.20
Jan 5, 2026
Merged

Fixed crash when editingLandmark is null#26
sleepingdragoninn merged 1 commit into
HestiMae:1.20from
Nico44YT:1.20

Conversation

@Nico44YT

@Nico44YT Nico44YT commented Jan 2, 2026

Copy link
Copy Markdown
Contributor
net.minecraft.class_148: mouseClicked event handler
	at net.minecraft.class_437.method_25412(class_437.java:414) ~[client-intermediary.jar:?]
	at net.minecraft.class_312.method_1601(class_312.java:98) ~[client-intermediary.jar:?]
	at net.minecraft.class_312.method_22686(class_312.java:169) ~[client-intermediary.jar:?]
	at net.minecraft.class_1255.execute(class_1255.java:102) ~[client-intermediary.jar:?]
	at net.minecraft.class_312.method_22684(class_312.java:169) ~[client-intermediary.jar:?]
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43) ~[lwjgl-glfw-3.3.1.jar:?]
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.1.jar:?]
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3403) ~[lwjgl-glfw-3.3.1.jar:?]
	at com.mojang.blaze3d.systems.RenderSystem.pollEvents(RenderSystem.java:201) ~[client-intermediary.jar:?]
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:219) ~[client-intermediary.jar:?]
	at net.minecraft.class_1041.method_15998(class_1041.java:288) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1523(class_310.java:1241) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1514(class_310.java:802) ~[client-intermediary.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:250) ~[minecraft-1.20.1-client.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:514) ~[fabric-loader-0.18.3.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:72) ~[fabric-loader-0.18.3.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.18.3.jar:?]
	at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:102) ~[NewLaunch.jar:?]
	at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) ~[NewLaunch.jar:?]
	at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[NewLaunch.jar:?]
Caused by: java.lang.NullPointerException: Cannot invoke "folk.sisby.surveyor.landmark.Landmark.getOrDefault(folk.sisby.surveyor.landmark.component.LandmarkComponentType, Object)" because "this.editingLandmark" is null
	at garden.hestia.hoofprint.HoofprintScreen.method_25402(HoofprintScreen.java:589) ~[hoofprint-1.2.0+1.20.jar:?]
	at net.minecraft.class_312.method_1611(class_312.java:98) ~[client-intermediary.jar:?]
	at net.minecraft.class_437.method_25412(class_437.java:409) ~[client-intermediary.jar:?]
	... 19 more

@sleepingdragoninn

Copy link
Copy Markdown
Collaborator

I've seen this crash too, but there's one thing I can't figure out. what branch is actually being followed that allows this to occur?

@Memori-

Memori- commented Jan 4, 2026

Copy link
Copy Markdown

Possibly here:

else if (hoveredLandmark != null && SurveyorClient.canModify(hoveredLandmark.owner()) && hoveredLandmark.contains(LandmarkComponentTypes.POS))

If hoveredLandmark is not null, but canModify or contains fails, there's nothing to handle that condition. Probably better to put the canModify && contains check in a nested IF and return on ELSE.

@sleepingdragoninn

sleepingdragoninn commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

Thank you! @Nico44YT could you modify the PR as such? users can still hold ALT if they want to dodge a hovered landmark to create a new one, but it's confusing if trying to edit an unmodifiable landmark just makes a new one.

Both implementations follow this, but just making an else branch is much more clear.

@sleepingdragoninn
sleepingdragoninn merged commit 0ad6202 into HestiMae:1.20 Jan 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants