From 1ee68d4e091f6989f0f123310e7b2a789b9aa76c Mon Sep 17 00:00:00 2001 From: Glen Husman Date: Sat, 17 May 2014 20:00:40 -0700 Subject: [PATCH] attemptLoadFrom will throw IllegalArgumentException for arrays of length 1 with a null element --- .../java/com/comphenix/protocol/utility/ClassSource.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ClassSource.java b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ClassSource.java index a801a269..293e0e2a 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ClassSource.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/ClassSource.java @@ -77,13 +77,13 @@ public abstract class ClassSource { return ClassSource.empty(); } - ClassSource source = sources[0]; - for(int i = 1; i < sources.length; i++){ - if(source == null || sources[i] == null){ + ClassSource source = null; + for(int i = 0; i < sources.length; i++){ + if(sources[i] == null){ throw new IllegalArgumentException("Null values are not permitted as ClassSources."); } - source = source.retry(sources[i]); + source = source == null ? sources[i] : source.retry(sources[i]); } return source; }