Skip to content

Commit b1166f7

Browse files
committed
fix:CustomAttachment Exception
1 parent ccca696 commit b1166f7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

android/src/main/java/com/netease/im/ReactCache.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ public static Object createRecentList(List<RecentContact> recents, int unreadNum
208208
}
209209
CustomAttachment attachment = null;
210210
try {
211-
attachment = (CustomAttachment) contact.getAttachment();
211+
if (contact.getMsgType() == MsgTypeEnum.custom) {
212+
attachment = (CustomAttachment) contact.getAttachment();
213+
}
212214
} catch (Exception e) {
213215
e.printStackTrace();
214216
}
@@ -747,7 +749,7 @@ public static WritableMap createMessage(IMMessage item) {
747749
imageObj.putString("thumbPath", imageAttachment.getPath());
748750
} else {
749751
imageObj.putString("thumbPath2", imageAttachment.getThumbPathForSave());
750-
imageObj.putString("thumbPath", imageAttachment.getThumbPath());
752+
imageObj.putString("thumbPath", imageAttachment.getThumbPath());
751753
}
752754
imageObj.putString("path2", imageAttachment.getPathForSave());
753755
imageObj.putString("path", imageAttachment.getPath());

0 commit comments

Comments
 (0)