aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0466-Return-chat-component-with-empty-text-instead-of-thr.patch
blob: 20c17b39c0543d21e5f031d8a73dfc233a61a324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: CDFN <codefun@protonmail.com>
Date: Tue, 7 Jul 2020 17:53:23 +0200
Subject: [PATCH] Return chat component with empty text instead of throwing
 exception


diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 8a03f31d07e467288dd518c99f3f29bc77eac058..3b92fb173f623a05ae99c86d98f2ecdf907f58c4 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -93,7 +93,12 @@ public abstract class AbstractContainerMenu {
     }
     private Component title;
     public final Component getTitle() {
-        Preconditions.checkState(this.title != null, "Title not set");
+        // Paper start - return chat component with empty text instead of throwing error
+        // Preconditions.checkState(this.title != null, "Title not set");
+        if (this.title == null){
+            return Component.literal("");
+        }
+        // Paper end - return chat component with empty text instead of throwing error
         return this.title;
     }
     public final void setTitle(Component title) {