Address nullability of C()

This commit is contained in:
Draycia committed 2020-06-30 09:49:56 -07:00
1 parent 7150b4c755
commit b70b51cb5c
1 file changed
+6 -2
@@ -60,9 +60,13 @@ public final class ItemStackUtils {
try {
final Object cbItemStack = this.asNMSCopyMethod.invoke(null, itemStack);
final Object nbtTag = this.cMethod.invoke(cbItemStack);
final Object mojangComponent = this.cMethod.invoke(cbItemStack);
return MinecraftComponentSerializer.INSTANCE.deserialize(nbtTag);
if (mojangComponent == null) {
return TextComponent.empty();
}
return MinecraftComponentSerializer.INSTANCE.deserialize(mojangComponent);
} catch (final IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
return TextComponent.empty();