From f9a373566ab1caf9dfc9003e75c1f29cab9f902d Mon Sep 17 00:00:00 2001 From: leizhao Date: Mon, 16 Oct 2023 15:18:29 +0800 Subject: [PATCH] fix-dynamic-array-decode-null-pointer --- abi/src/main/java/org/web3j/abi/TypeDecoder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/abi/src/main/java/org/web3j/abi/TypeDecoder.java b/abi/src/main/java/org/web3j/abi/TypeDecoder.java index 0411b18a3..eb9394504 100644 --- a/abi/src/main/java/org/web3j/abi/TypeDecoder.java +++ b/abi/src/main/java/org/web3j/abi/TypeDecoder.java @@ -564,6 +564,9 @@ private static T decodeDynamicParameterFromStruct( if (DynamicStruct.class.isAssignableFrom(declaredField)) { value = decodeDynamicStruct(dynamicElementData, 0, TypeReference.create(declaredField)); } else if (DynamicArray.class.isAssignableFrom(declaredField)) { + if (parameter == null) { + throw new RuntimeException("parameter can not be null, try to use annotation @Parameterized to specify the parameter type"); + } value = (T) decodeDynamicArray(