Fixed possible NPE in media browser.

This commit is contained in:
Felix Ableitner 2013-09-19 22:16:12 +02:00
parent 89de580223
commit 2926d3af2f

View file

@ -76,11 +76,12 @@ public class FileArrayAdapter extends ArrayAdapter<DIDLObject> {
TextView title = (TextView) convertView.findViewById(R.id.title); TextView title = (TextView) convertView.findViewById(R.id.title);
TextView artist = (TextView) convertView.findViewById(R.id.subtitle); TextView artist = (TextView) convertView.findViewById(R.id.subtitle);
RemoteImageView image = (RemoteImageView) convertView.findViewById(R.id.image); RemoteImageView image = (RemoteImageView) convertView.findViewById(R.id.image);
MusicTrack track;
if (item instanceof MusicTrack) { if (item instanceof MusicTrack) {
track = (MusicTrack) item; MusicTrack track = (MusicTrack) item;
title.setText(Integer.toString(track.getOriginalTrackNumber()) + String trackNumber = (track.getOriginalTrackNumber() != null)
". " + item.getTitle()); ? Integer.toString(track.getOriginalTrackNumber()) + ". "
: "";
title.setText(trackNumber + item.getTitle());
artist.setText(track.getArtists()[0].getName()); artist.setText(track.getArtists()[0].getName());
} }
else { else {