From 40c0618a3a4d7edaf1735b5f638ea2720296f82c Mon Sep 17 00:00:00 2001 From: Jedediah Smith Date: Wed, 30 Sep 2015 20:43:35 -0400 Subject: [PATCH] Fix NPE from duplicating TranslatableComponent --- .../md_5/bungee/api/chat/TranslatableComponent.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java b/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java index c9a120f2..7959185f 100644 --- a/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java +++ b/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java @@ -41,9 +41,15 @@ public class TranslatableComponent extends BaseComponent { super( original ); setTranslate( original.getTranslate() ); - for ( BaseComponent baseComponent : original.getWith() ) + + if ( original.getWith() != null ) { - with.add( baseComponent.duplicate() ); + List temp = new ArrayList(); + for ( BaseComponent baseComponent : original.getWith() ) + { + temp.add( baseComponent.duplicate() ); + } + setWith( temp ); } }