mojira.dev
MC-106800

When selecting a server with a LAN server in the list, pressing the down key when selecting the last server will crash

The bug

When selecting a server to play on in the "Multiplayer" menu, if the last server on your server list is selected, and there is a local network server on the list below it, pressing the "Down" arrow key will cause a crash.

Crash report

18w02a\: [^crash-2018-01-12_20.42.32-client.txt]

Description: keyPressed event handler

java.lang.IndexOutOfBoundsException: Index: 10, Size: 9
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at bpo$b.a(SourceFile:100)
	at bpo$b.get(SourceFile:95)
	at btm.b(SourceFile:338)
	at btm.keyPressed(SourceFile:286)
	at bny.a(SourceFile:269)
	at bny$$Lambda$364/75867593.run(Unknown Source)
	at brs.a(SourceFile:426)
	at bny.a(SourceFile:267)
	at bny$$Lambda$270/2088661957.invoke(Unknown Source)
	at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23)
	at org.lwjgl.system.JNI.invokeV(Native Method)
	at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:2599)
	at bol.a(SourceFile:294)
	at bob.b(SourceFile:848)
	at bob.a(SourceFile:382)
	at net.minecraft.client.main.Main.main(SourceFile:140)

Linked issues

Attachments

Comments 8

Please attach the crashlog.

Confirmed. This only happens if there is a LAN server in the list, though; if there is no LAN server on the list, then nothing happens.

I think this is caused by the following:

Minecraft might have an array or arraylist of servers (except for LAN) that appear in the server selection menu. When the down arrow is pressed, Minecraft tries to increment the index of the selected server. There is, of course, a check to make sure that you can't go beyond the bounds of the array/arraylist. The bound would be finding the total number of servers on the list, including the LAN servers. So when the last server is selected and the down arrow is pressed, Minecraft increments the index beyond the bounds of the array/arraylist, causing the exception

Source: Just an idea, might be completely wrong.

If I recall correctly, it is something like that (bounds-checking against one list but not the other list, or using the wrong list's size).

what it's doing it it's checking for lan array and server array as two separate arrays without checks for when it's last of server and down. Or first up on land and up arrow key

so the solution is to either switch arrays when the key goes out of bounds or to prevent it entirely from switching indexes from one list to another

This has been fixed at some point.

TriMill

(Unassigned)

Confirmed

Crash

crash, lan-world, server-list

Minecraft 1.10.2, Minecraft 16w35a, Minecraft 16w39a, Minecraft 16w44a, Minecraft 1.11 Pre-Release 1, ..., Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w04b, Minecraft 19w05a, Minecraft 19w06a

1.14.4

Retrieved