[Android] src: Fix NullPointerException in VideoPlayerHandler

Edward Wang git at videolan.org
Fri Aug 3 17:05:52 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Fri Aug  3 11:05:33 2012 -0400| [b530f4bcacc2e154d52b9bc018d23e0e72d618b2] | committer: Edward Wang

src: Fix NullPointerException in VideoPlayerHandler

WeakReference could be null.

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index a3aced1..5c83445 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -516,6 +516,9 @@ public class VideoPlayerActivity extends Activity {
         @Override
         public void handleMessage(Message msg) {
             VideoPlayerActivity activity = getOwner();
+            if(activity == null) // WeakReference could be GC'ed early
+                return;
+
             switch (msg.what) {
                 case FADE_OUT:
                     activity.hideOverlay(false);



More information about the Android mailing list