[Android] Prevent rare NPE in AudioPlayer

Geoffrey Métais git at videolan.org
Thu Oct 30 15:30:36 CET 2014


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Oct 29 17:19:45 2014 +0100| [efe3a4bb0543a88b35444702adf6a6cb76a7093b] | committer: Geoffrey Métais

Prevent rare NPE in AudioPlayer

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index fb2f931..f24fabc 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -483,12 +483,14 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
 
     public void show() {
         MainActivity activity = (MainActivity)getActivity();
-        activity.showAudioPlayer();
+        if (activity != null)
+            activity.showAudioPlayer();
     }
 
     public void hide() {
         MainActivity activity = (MainActivity)getActivity();
-        activity.hideAudioPlayer();
+        if (activity != null)
+            activity.hideAudioPlayer();
     }
 
     /**



More information about the Android mailing list