Enforce sign line nullability when setting line with Adventure Method (#9689)

This commit is contained in:
thelooter 2023-09-16 23:18:51 +02:00 committed by GitHub
parent deb92c2129
commit 0c8e84c20d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3279,10 +3279,10 @@ index bd43440fcbcf461fb8ca94b96cd256f392efeb84..5af30bff1bfdf09daa585071f2ec1fe0
Component[] components = new Component[4]; Component[] components = new Component[4];
diff --git a/src/main/java/org/bukkit/craftbukkit/block/sign/CraftSignSide.java b/src/main/java/org/bukkit/craftbukkit/block/sign/CraftSignSide.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/sign/CraftSignSide.java b/src/main/java/org/bukkit/craftbukkit/block/sign/CraftSignSide.java
index 43f6ac44525048faf0b0cd2c11f9bc36fa0cab5d..1317cdd48c1c27c9e5152da5403237b1bb15ac52 100644 index 43f6ac44525048faf0b0cd2c11f9bc36fa0cab5d..4747d77fd5fd12116ef40d897a08c7baca60a399 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/sign/CraftSignSide.java --- a/src/main/java/org/bukkit/craftbukkit/block/sign/CraftSignSide.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/sign/CraftSignSide.java +++ b/src/main/java/org/bukkit/craftbukkit/block/sign/CraftSignSide.java
@@ -12,37 +12,69 @@ import org.jetbrains.annotations.Nullable; @@ -12,37 +12,70 @@ import org.jetbrains.annotations.Nullable;
public class CraftSignSide implements SignSide { public class CraftSignSide implements SignSide {
// Lazily initialized only if requested: // Lazily initialized only if requested:
@ -3313,6 +3313,7 @@ index 43f6ac44525048faf0b0cd2c11f9bc36fa0cab5d..1317cdd48c1c27c9e5152da5403237b1
+ +
+ @Override + @Override
+ public void line(final int index, final net.kyori.adventure.text.@NotNull Component line) throws IndexOutOfBoundsException { + public void line(final int index, final net.kyori.adventure.text.@NotNull Component line) throws IndexOutOfBoundsException {
+ com.google.common.base.Preconditions.checkArgument(line != null, "Line cannot be null");
+ this.loadLines(); + this.loadLines();
+ this.lines.set(index, line); + this.lines.set(index, line);
+ } + }
@ -3365,7 +3366,7 @@ index 43f6ac44525048faf0b0cd2c11f9bc36fa0cab5d..1317cdd48c1c27c9e5152da5403237b1
} }
@Override @Override
@@ -68,13 +100,16 @@ public class CraftSignSide implements SignSide { @@ -68,13 +101,16 @@ public class CraftSignSide implements SignSide {
public SignText applyLegacyStringToSignSide() { public SignText applyLegacyStringToSignSide() {
if (this.lines != null) { if (this.lines != null) {