diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-12-03 10:45:47 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-12-03 10:45:47 +0100 |
commit | 8f62d95e1fb5980daab5294148106ce09237e386 (patch) | |
tree | b4c00a4645acc5ae76a72b8f6a44ddc818abd4fe /src/main/java/eu/siacs/conversations/ui/adapter | |
parent | aaeba697bd3fe5fa74ef726fd5a99de496fd92f2 (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.java | 16 |
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; |