]> git.bitcoin.ninja Git - ldk-java/commitdiff
[Java] Handle nullable arrays
authorMatt Corallo <git@bluematt.me>
Fri, 28 Oct 2022 05:53:01 +0000 (05:53 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 28 Oct 2022 18:34:07 +0000 (18:34 +0000)
src/main/java/org/ldk/util/InternalUtils.java

index f26c2ae06daa140816fdb9cb16da1d6aecedcb86..d9c3f6ef8364a4f89ec1c2653f5d747455325345 100644 (file)
@@ -2,7 +2,7 @@ package org.ldk.util;
 
 public class InternalUtils {
     public static byte[] check_arr_len(byte[] arr, int length) throws IllegalArgumentException {
-        if (arr.length != length) {
+        if (arr != null && arr.length != length) {
             throw new IllegalArgumentException("Array must be of fixed size " + length + " but was of length " + arr.length);
         }
         return arr;