aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui/adapter
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-12-03 10:45:47 +0100
committeriNPUTmice <daniel@gultsch.de>2014-12-03 10:45:47 +0100
commit8f62d95e1fb5980daab5294148106ce09237e386 (patch)
treeb4c00a4645acc5ae76a72b8f6a44ddc818abd4fe /src/main/java/eu/siacs/conversations/ui/adapter
parentaaeba697bd3fe5fa74ef726fd5a99de496fd92f2 (diff)
further npe checks
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/adapter')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
index 250a69c3a..0865d1aaf 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
@@ -5,6 +5,8 @@ import java.util.List;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.ListItem;
import eu.siacs.conversations.ui.XmppActivity;
+import eu.siacs.conversations.xmpp.jid.Jid;
+
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
@@ -36,8 +38,8 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
if (view == null) {
view = inflater.inflate(R.layout.contact, parent, false);
}
- TextView name = (TextView) view.findViewById(R.id.contact_display_name);
- TextView jid = (TextView) view.findViewById(R.id.contact_jid);
+ TextView tvName = (TextView) view.findViewById(R.id.contact_display_name);
+ TextView tvJid = (TextView) view.findViewById(R.id.contact_jid);
ImageView picture = (ImageView) view.findViewById(R.id.contact_photo);
LinearLayout tagLayout = (LinearLayout) view.findViewById(R.id.tags);
@@ -54,9 +56,13 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
tagLayout.addView(tv);
}
}
-
- jid.setText(item.getJid().toString());
- name.setText(item.getDisplayName());
+ final Jid jid = item.getJid();
+ if (jid != null) {
+ tvJid.setText(jid.toString());
+ } else {
+ tvJid.setText("");
+ }
+ tvName.setText(item.getDisplayName());
picture.setImageBitmap(activity.avatarService().get(item,
activity.getPixel(48)));
return view;