diff options
Diffstat (limited to 'src/main/javassist/bytecode')
-rw-r--r-- | src/main/javassist/bytecode/MethodParametersAttribute.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/javassist/bytecode/MethodParametersAttribute.java b/src/main/javassist/bytecode/MethodParametersAttribute.java index b9c252a9..f78f6c72 100644 --- a/src/main/javassist/bytecode/MethodParametersAttribute.java +++ b/src/main/javassist/bytecode/MethodParametersAttribute.java @@ -32,7 +32,8 @@ public class MethodParametersAttribute extends AttributeInfo { byte[] data = new byte[names.length * 4 + 1]; data[0] = (byte)names.length; for (int i = 0; i < names.length; i++) { - ByteArray.write16bit(cp.addUtf8Info(names[i]), data, i * 4 + 1); + String name = names[i]; + ByteArray.write16bit(name == null ? 0 : cp.addUtf8Info(name), data, i * 4 + 1); ByteArray.write16bit(flags[i], data, i * 4 + 3); } @@ -61,7 +62,8 @@ public class MethodParametersAttribute extends AttributeInfo { * @param i the position of the parameter. */ public String parameterName(int i) { - return getConstPool().getUtf8Info(name(i)); + int index = name(i); + return index == 0 ? null : getConstPool().getUtf8Info(index); } /** @@ -87,7 +89,8 @@ public class MethodParametersAttribute extends AttributeInfo { String[] names = new String[s]; int[] flags = new int[s]; for (int i = 0; i < s; i++) { - names[i] = cp.getUtf8Info(name(i)); + int index = name(i); + names[i] = index == 0 ? null : cp.getUtf8Info(index); flags[i] = accessFlags(i); } |