This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git


The following commit(s) were added to refs/heads/master by this push:
     new 4498ccf8 Better NPE message
4498ccf8 is described below

commit 4498ccf816a0aef4c5d93743ec9ccabc7bf35d27
Author: Gary Gregory <[email protected]>
AuthorDate: Mon May 15 20:55:00 2023 -0400

    Better NPE message
---
 .../java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java 
b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java
index 83685bb5..cc84f955 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java
@@ -17,6 +17,7 @@
 package org.apache.commons.imaging.formats.png.chunks;
 
 import java.io.ByteArrayInputStream;
+import java.util.Objects;
 
 import org.apache.commons.imaging.common.BinaryFileParser;
 
@@ -49,7 +50,7 @@ public class PngChunk extends BinaryFileParser {
         this.length = length;
         this.chunkType = chunkType;
         this.crc = crc;
-        this.bytes = bytes.clone();
+        this.bytes = Objects.requireNonNull(bytes, "bytes").clone();
 
         propertyBits = new boolean[4];
         int shift = 24;

Reply via email to