[Android] VideoPlayer: fix potential crash
Jean-Baptiste Kempf
git at videolan.org
Sun Jun 15 17:23:40 CEST 2014
vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Jun 15 17:20:26 2014 +0200| [1e60d82a6d88d61abfae104198703631097080ac] | committer: Jean-Baptiste Kempf
VideoPlayer: fix potential crash
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=1e60d82a6d88d61abfae104198703631097080ac
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
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 6e35027..9564a5e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1551,7 +1551,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
Log.d(TAG, "Pixel format is YV12");
else
Log.d(TAG, "Pixel format is other/unknown");
- if(holder != null)
+ if(mLibVLC != null)
mLibVLC.attachSurface(holder.getSurface(), VideoPlayerActivity.this);
}
@@ -1561,14 +1561,16 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
- mLibVLC.detachSurface();
+ if(mLibVLC != null)
+ mLibVLC.detachSurface();
}
};
private final SurfaceHolder.Callback mSubtitlesSurfaceCallback = new Callback() {
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- mLibVLC.attachSubtitlesSurface(holder.getSurface());
+ if(mLibVLC != null)
+ mLibVLC.attachSubtitlesSurface(holder.getSurface());
}
@Override
@@ -1577,7 +1579,8 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
- mLibVLC.detachSubtitlesSurface();
+ if(mLibVLC != null)
+ mLibVLC.detachSubtitlesSurface();
}
};
More information about the Android
mailing list