From c5256195d6f888d6f6081b68e9453f17a5ed2c0b Mon Sep 17 00:00:00 2001 From: Thach Le Date: Mon, 1 Jul 2024 23:16:54 +0700 Subject: [PATCH] Handle NPE --- src/main/java/io/lettuce/core/codec/ByteArrayCodec.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/lettuce/core/codec/ByteArrayCodec.java b/src/main/java/io/lettuce/core/codec/ByteArrayCodec.java index c8a9cffd06..bcecd3d283 100644 --- a/src/main/java/io/lettuce/core/codec/ByteArrayCodec.java +++ b/src/main/java/io/lettuce/core/codec/ByteArrayCodec.java @@ -90,9 +90,11 @@ public ByteBuffer encodeValue(byte[] value) { } private static byte[] getBytes(ByteBuffer buffer) { + if (buffer == null) { + return EMPTY; + } int remaining = buffer.remaining(); - if (remaining == 0) { return EMPTY; }