[Android] Avoid crash on context void

Jean-Baptiste Kempf git at videolan.org
Wed Oct 3 12:35:02 CEST 2012


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Oct  3 12:34:47 2012 +0200| [ebe09b0ebba93dbc150d68ac9fc0b8f89107b7b8] | committer: Jean-Baptiste Kempf

Avoid crash on context void

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

 .../src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java        |    4 ++++
 1 file changed, 4 insertions(+)

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 e093fd6..d3ac1d9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
@@ -118,6 +118,10 @@ public class AudioPlayerActivity extends Activity implements IAudioPlayer {
     }
 
     public static void start(Context context, Boolean dontParse) {
+        if (context == null) {
+            Log.e(TAG, "No context when starting AudioPlayerActivity");
+            return;
+        }
         Intent intent = new Intent(context, AudioPlayerActivity.class);
         intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         if (dontParse)



More information about the Android mailing list