From 09ca74d2435fd0e170d28c8e1493a64faed18ab7 Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 29 Sep 2025 12:52:49 +0100 Subject: [PATCH] fix: handle null check for empty `data` in `Message` decoding logic --- lib/src/main/java/io/ably/lib/types/BaseMessage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/main/java/io/ably/lib/types/BaseMessage.java b/lib/src/main/java/io/ably/lib/types/BaseMessage.java index 44b91d7e2..10c6ba42b 100644 --- a/lib/src/main/java/io/ably/lib/types/BaseMessage.java +++ b/lib/src/main/java/io/ably/lib/types/BaseMessage.java @@ -171,11 +171,11 @@ public void decode(ChannelOptions opts, DecodingContext context) throws Message } //last message bookkeping - if(lastPayload instanceof String) + if (lastPayload instanceof String) context.setLastMessageData((String)lastPayload); else if (lastPayload instanceof byte[]) context.setLastMessageData((byte[])lastPayload); - else + else if (lastPayload != null) throw MessageDecodeException.fromDescription("Message data neither String nor byte[]. Unsupported message data type."); }