From bfb0683b1ff40654cc203606e2433d73338d2a0a Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Wed, 28 Jan 2015 21:30:17 -0500 Subject: [PATCH] Don't take fieldIndex into account when checking for nonexistent fields --- .../com/comphenix/protocol/reflect/StructureModifier.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java index 238a6559..f3007930 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java @@ -193,7 +193,7 @@ public class StructureModifier { if (fieldIndex < 0) throw new FieldAccessException(String.format("Field index (%s) cannot be negative.", fieldIndex)); - if (fieldIndex == 0 && data.size() == 0) + if (data.size() == 0) throw new FieldAccessException(String.format("No field with type %s exists in class %s.", targetType.getName(), target.getClass().getName())); @@ -294,8 +294,9 @@ public class StructureModifier { if (fieldIndex < 0) throw new FieldAccessException(String.format("Field index (%s) cannot be negative.", fieldIndex)); - if (fieldIndex == 0 && data.size() == 0) - throw new FieldAccessException(String.format("No field with type %s exists in class %s.", targetType.getName(), target.getClass().getName())); + if (data.size() == 0) + throw new FieldAccessException(String.format("No field with type %s exists in class %s.", targetType.getName(), + target.getClass().getName())); if (fieldIndex >= data.size()) throw new FieldAccessException(String.format("Field index out of bounds. (Index: %s, Size: %s)", fieldIndex, data.size()));