Skip to content

Commit 8d8f98c

Browse files
committed
Prevent indexOutOfBounds
1 parent d4fd821 commit 8d8f98c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: HaHaWTH <id_cn00@outlook.com>
3+
Date: Sun, 7 Apr 2024 16:43:25 +0800
4+
Subject: [PATCH] Dionysus-prevent-IndexOutOfBounds
5+
6+
7+
diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java
8+
index bf684956d9919e54c8ccd7a3b152c1cf8454c9bc..49d64b10a23ad5adf824f8012a7cd20cc7260a82 100644
9+
--- a/src/main/java/net/minecraft/server/Container.java
10+
+++ b/src/main/java/net/minecraft/server/Container.java
11+
@@ -112,7 +112,13 @@ public abstract class Container {
12+
}
13+
14+
public Slot getSlot(int i) {
15+
- return (Slot) this.slots.get(i);
16+
+ // Beast start - Prevent IndexOutOfBoundsException
17+
+ try {
18+
+ return (Slot) this.slots.get(i);
19+
+ } catch (IndexOutOfBoundsException e) {
20+
+ return null;
21+
+ }
22+
+ // Beast end
23+
}
24+
25+
public ItemStack shiftClick(EntityHuman entityhuman, int i) {

0 commit comments

Comments
 (0)