Skip to content

Commit 9b3d73a

Browse files
Fix NPE when reading null keys in Message metadata
Added a null check for keys when deserializing metadata in the Message class to prevent NullPointerException during parceling.
1 parent ee2d621 commit 9b3d73a

File tree

1 file changed

+3
-1
lines changed
  • kommunicate/src/main/java/io/kommunicate/devkit/api/conversation

1 file changed

+3
-1
lines changed

kommunicate/src/main/java/io/kommunicate/devkit/api/conversation/Message.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ public Message(Parcel in) {
149149
for (int i = 0; i < metadataSize; i++) {
150150
String key = in.readString();
151151
String value = in.readString();
152-
metadata.put(key, value);
152+
if (key != null) {
153+
metadata.put(key, value);
154+
}
153155
}
154156
status = (short) in.readInt();
155157
hidden = in.readByte() != 0;

0 commit comments

Comments
 (0)