From 2926d3af2f54e47e4e673513c75b7730b787e857 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 19 Sep 2013 22:16:12 +0200 Subject: [PATCH] Fixed possible NPE in media browser. --- src/com/github/nutomic/controldlna/FileArrayAdapter.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/com/github/nutomic/controldlna/FileArrayAdapter.java b/src/com/github/nutomic/controldlna/FileArrayAdapter.java index fa5215c..47efbac 100644 --- a/src/com/github/nutomic/controldlna/FileArrayAdapter.java +++ b/src/com/github/nutomic/controldlna/FileArrayAdapter.java @@ -76,11 +76,12 @@ public class FileArrayAdapter extends ArrayAdapter { TextView title = (TextView) convertView.findViewById(R.id.title); TextView artist = (TextView) convertView.findViewById(R.id.subtitle); RemoteImageView image = (RemoteImageView) convertView.findViewById(R.id.image); - MusicTrack track; if (item instanceof MusicTrack) { - track = (MusicTrack) item; - title.setText(Integer.toString(track.getOriginalTrackNumber()) + - ". " + item.getTitle()); + MusicTrack track = (MusicTrack) item; + String trackNumber = (track.getOriginalTrackNumber() != null) + ? Integer.toString(track.getOriginalTrackNumber()) + ". " + : ""; + title.setText(trackNumber + item.getTitle()); artist.setText(track.getArtists()[0].getName()); } else {