Skip to content

Commit 96fbe1b

Browse files
authored
Merge pull request #1168 from ably/ECO-5570/fix-decoding-empty-data
fix: handle null check for empty `data` in `Message` decoding logic
2 parents 13b8e2e + 09ca74d commit 96fbe1b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/src/main/java/io/ably/lib/types/BaseMessage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ public void decode(ChannelOptions opts, DecodingContext context) throws Message
171171
}
172172

173173
//last message bookkeping
174-
if(lastPayload instanceof String)
174+
if (lastPayload instanceof String)
175175
context.setLastMessageData((String)lastPayload);
176176
else if (lastPayload instanceof byte[])
177177
context.setLastMessageData((byte[])lastPayload);
178-
else
178+
else if (lastPayload != null)
179179
throw MessageDecodeException.fromDescription("Message data neither String nor byte[]. Unsupported message data type.");
180180
}
181181

0 commit comments

Comments
 (0)