mojira.dev
MC-310177

Game will crash when there're line break characters in the same place of Friend List confirmation screen

Short description of the issue
Adding line break characters (\n) in the same place via a resource pack to the text displayed on the Friend List confirmation screen causes the game to crash with an IllegalArgumentException due to a zero‑height scissor rectangle during rendering.

Steps to reproduce the issue

  1. Create a resource pack that modifies the language file (e.g., en_us.json), inserting atleast two \n characters into the relevant string.

  2. Load the resource pack and restart the game.

  3. Open the Friends List and trigger the confirmation screen that displays the modified text.

  4. Observe that the game immediately crashes, and the launcher shows the error stack trace.

Expected result
The screen should render the text with the line breaks correctly, wrapping the text onto a new line without affecting the rendering pipeline. The scissor region should accommodate the full height of the multi‑line text, and the game should continue running normally.

Actual result
The game crashes with a ReportedException during the render frame. The underlying cause is:
java.lang.IllegalArgumentException: Scissor size must be >0, was 292x0
The crash screen displays: The game crashed: render frame Error: java.lang.IllegalArgumentException: Scissor size must be >0, was 292x0.
Full stack trace (relevant part):

text

net.minecraft.ReportedException: Render Frame
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1274)
	...
Caused by: java.lang.IllegalArgumentException: Scissor size must be >0, was 292x0
	at com.mojang.blaze3d.systems.RenderPass.enableScissor(RenderPass.java:110)
	at net.minecraft.client.gui.render.GuiRenderer.enableScissor(GuiRenderer.java:418)
	at net.minecraft.client.gui.render.GuiRenderer.executeDraw(GuiRenderer.java:378)
	...

Analysis & Root Cause

The crash occurs in the GUI rendering pipeline, specifically when RenderPass.enableScissor() is called with a height of 0. The scissor rectangle is used to clip rendering to a defined region (e.g., the bounds of a text area).

The text component that contains \n is being processed by the game’s text layout engine. When the text is rendered, the GUI system computes the bounding box (width and height) of the text to set up the scissor region. However, if the text consists only of a line break (or if the line break causes the layout to produce an empty line with zero height), the resulting height can become 0. In this specific case, the width is computed as 292 (non‑zero) but the height is 0, triggering the validation check in RenderPass.enableScissor() which requires both dimensions to be strictly positive.

The root cause is that the text‑layout routine does not handle the case where a string containing \n yields a zero‑pixel tall bounding box (e.g., if the text is empty after stripping whitespace, or if the layout engine mistakenly calculates the height of a trailing newline as 0). The GUI renderer then blindly passes this zero height to the scissor function without a guard, causing an immediate exception.

This is a defensive programming issue: the text layout and rendering code should either ensure a minimum height (e.g., at least the font’s line height) or skip enabling the scissor when the region has zero area. The validation in RenderPass is correct (it prevents invalid GPU commands), but the caller should not invoke it with invalid parameters.

Suggested Fix

  • In the text layout logic, after computing the text bounds, clamp the height to at least Math.max(1, font.lineHeight) so that a single newline or empty text never yields a zero‑height region.

  • Alternatively, in GuiRenderer.enableScissor(), add a check: if the width or height is ≤ 0, skip the scissor operation entirely (or fall back to the parent’s scissor region).

  • Ensure that all text components that may contain user‑supplied or resource‑pack‑modified strings are robust against unexpected formatting characters like \n.

Comments 2

We do not have enough resources to reproduce this issue.

Please attach a minimal setup resource pack that can be used to reproduce this issue.

This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

I recreated a resource pack and insert some \n there, but nothing happend.

I tried more than 10 times, and finally found the actual issue: When any button with scrolling text and be pushed out of window, the game will crash. The game crashed this time is just because both the text on the buttons are too long and be pushed by other text on the Friend List confirmation screen.

So, I will recreate a Bug Report with the actual issue, and this one should be “Invalid“.

xzq123xzq456

(Unassigned)

Unconfirmed

26.2

Retrieved