[Android] [PATCH] Prevent rare NPE in AudioPlayer

Geoffrey Métais geoffrey.metais at gmail.com
Wed Oct 29 17:21:35 CET 2014


---
 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 8748107..8540647 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();
     }
 
     /**
-- 
1.9.1



More information about the Android mailing list