~singpolyma/cheogram-android

b0425c97cfa47faedc783d9f9df6a99c170150f5 — Stephen Paul Weber 1 year, 2 months ago 8a7c545
Fix crash ("   ".split("\\s+") is empty array)
M src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java => src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +3 -2
@@ 204,8 204,9 @@ public class ConversationAdapter
            if (message.getStatus() == Message.STATUS_RECEIVED) {
                if (conversation.getMode() == Conversation.MODE_MULTI) {
                    viewHolder.binding.senderName.setVisibility(View.VISIBLE);
                    viewHolder.binding.senderName.setText(
                            UIHelper.getMessageDisplayName(message).split("\\s+")[0] + ':');
                    final String dname = UIHelper.getMessageDisplayName(message);
                    final String[] words = dname.split("\\s+");
                    viewHolder.binding.senderName.setText((words.length > 0 ? words[0] : dname) + ':');
                } else {
                    viewHolder.binding.senderName.setVisibility(View.GONE);
                }

M src/main/java/eu/siacs/conversations/utils/UIHelper.java => src/main/java/eu/siacs/conversations/utils/UIHelper.java +4 -1
@@ 542,7 542,10 @@ public class UIHelper {
                } else {
                    if (conversation instanceof Conversation) {
                        final MucOptions.User user = ((Conversation) conversation).getMucOptions().findUserByFullJid(message.getCounterpart());
                        if (user != null) return getDisplayName(user);
                        if (user != null) {
                            final String dname = getDisplayName(user);
                            if (dname != null) return dname;
                        }
                    }
                    return getDisplayedMucCounterpart(message.getCounterpart());
                }