Mercurial > hg > graal-compiler
changeset 12467:b7fd9efe24c5
prevent npe in Buffer.copyData() when Buffer.data is null
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 17 Oct 2013 11:46:27 +0200 |
parents | b11213c41769 |
children | be9971b46cc8 |
files | graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java Thu Oct 17 10:52:56 2013 +0200 +++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java Thu Oct 17 11:46:27 2013 +0200 @@ -56,10 +56,14 @@ public byte[] close(boolean trimmedCopy) { byte[] result = trimmedCopy ? Arrays.copyOf(data, position()) : data; data = null; + position = 0; return result; } public byte[] copyData(int start, int end) { + if (data == null) { + return null; + } return Arrays.copyOfRange(data, start, end); }