[Android] AudioService: fix a NullPointerException

Ludovic Fauvet git at videolan.org
Fri May 24 17:49:57 CEST 2013


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Fri May 24 17:48:19 2013 +0200| [72a1f027f36fbc26bb5bab6e2848be545b816845] | committer: Ludovic Fauvet

AudioService: fix a NullPointerException

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=72a1f027f36fbc26bb5bab6e2848be545b816845
---

 vlc-android/src/org/videolan/vlc/AudioService.java |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 2746ba9..18afb62 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -434,8 +434,10 @@ public class AudioService extends Service {
                     service.updateWidgetPosition(service, pos);
                     break;
                 case EventHandler.MediaPlayerEncounteredError:
-                    service.showToast(VLCApplication.getAppContext().getString(R.string.invalid_location,
-                            service.mCurrentMedia.getLocation()), Toast.LENGTH_SHORT);
+                    if (service.mCurrentMedia != null) {
+                        service.showToast(service.getString(R.string.invalid_location,
+                                service.mCurrentMedia.getLocation()), Toast.LENGTH_SHORT);
+                    }
                     service.executeUpdate();
                     service.next();
                     if (service.mWakeLock.isHeld())



More information about the Android mailing list