mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-21 23:11:56 +01:00
SPIGOT-7399: Revert null check in CraftMetaItem#safelyAdd
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
20acc420d8
commit
f88d039091
@ -1329,7 +1329,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
||||
for (Object object : addFrom) {
|
||||
if (!(object instanceof String)) {
|
||||
Preconditions.checkArgument(object == null, "%s cannot contain non-string %s", addFrom, object.getClass().getName());
|
||||
if (object != null) {
|
||||
// SPIGOT-7399: Null check via if is important,
|
||||
// otherwise object.getClass().getName() could throw an error for a valid argument -> when it is null which is valid,
|
||||
// when using Preconditions
|
||||
throw new IllegalArgumentException(addFrom + " cannot contain non-string " + object.getClass().getName());
|
||||
}
|
||||
|
||||
addTo.add(CraftChatMessage.toJSON(IChatBaseComponent.empty()));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user