[Android] Audio: don't crash if title is null
Sébastien Toque
git at videolan.org
Mon Jul 23 19:53:21 CEST 2012
android | branch: master | Sébastien Toque <xilasz at gmail.com> | Mon Jul 23 16:48:50 2012 +0200| [10a3d98e6486051f392a98371aa3196d8931a513] | committer: Sébastien Toque
Audio: don't crash if title is null
> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=10a3d98e6486051f392a98371aa3196d8931a513
---
.../src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java | 5 +++--
vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
index 3501247..05b64c3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
@@ -131,14 +131,15 @@ public class AudioPlayerActivity extends Activity implements IAudioPlayer {
return;
}
- if (!mAudioController.getTitle().equals(lastTitle)) {
+ String title = mAudioController.getTitle();
+ if (title != null && !title.equals(lastTitle)) {
Bitmap cover = mAudioController.getCover();
if (cover != null)
mCover.setImageBitmap(cover);
else
mCover.setImageResource(R.drawable.cone);
}
- lastTitle = mAudioController.getTitle();
+ lastTitle = title;
mTitle.setText(lastTitle);
mArtist.setText(mAudioController.getArtist());
mAlbum.setText(mAudioController.getAlbum());
diff --git a/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java b/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java
index cedb06f..f6aa679 100644
--- a/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/widget/AudioMiniPlayer.java
@@ -161,7 +161,8 @@ public class AudioMiniPlayer extends Fragment implements IAudioPlayer {
return;
}
- if (!mAudioPlayerControl.getTitle().equals(lastTitle)) {
+ String title = mAudioPlayerControl.getTitle();
+ if (title != null && !title.equals(lastTitle)) {
Bitmap cover = mAudioPlayerControl.getCover();
if (cover != null) {
mCover.setVisibility(ImageView.VISIBLE);
@@ -171,7 +172,7 @@ public class AudioMiniPlayer extends Fragment implements IAudioPlayer {
}
}
- lastTitle = mAudioPlayerControl.getTitle();
+ lastTitle = title;
mTitle.setText(lastTitle);
mArtist.setText(mAudioPlayerControl.getArtist());
if (mAudioPlayerControl.isPlaying()) {
More information about the Android
mailing list