From d5ef2a1a46cfff09dd895b1412aa5535dfce71b5 Mon Sep 17 00:00:00 2001 From: Roman Strobl Date: Fri, 10 Jan 2025 09:36:06 +0100 Subject: [PATCH] Fix #341: Null pointer exception when setting certificates --- .../core/rest/client/base/RestClientConfiguration.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rest-client-base/src/main/java/com/wultra/core/rest/client/base/RestClientConfiguration.java b/rest-client-base/src/main/java/com/wultra/core/rest/client/base/RestClientConfiguration.java index f00ee1b..0150b0a 100644 --- a/rest-client-base/src/main/java/com/wultra/core/rest/client/base/RestClientConfiguration.java +++ b/rest-client-base/src/main/java/com/wultra/core/rest/client/base/RestClientConfiguration.java @@ -543,6 +543,10 @@ public byte[] getKeyStoreBytes() { * @param keyStoreBytes Byte data with the key store. */ public void setKeyStoreBytes(byte[] keyStoreBytes) { + if (keyStoreBytes == null) { + this.keyStoreBytes = null; + return; + } this.keyStoreBytes = Arrays.copyOf(keyStoreBytes, keyStoreBytes.length); } @@ -643,6 +647,10 @@ public byte[] getTrustStoreBytes() { * @param trustStoreBytes Byte data with the trust store. */ public void setTrustStoreBytes(byte[] trustStoreBytes) { + if (trustStoreBytes == null) { + this.trustStoreBytes = null; + return; + } this.trustStoreBytes = Arrays.copyOf(trustStoreBytes, trustStoreBytes.length); }