Merge "If media player has died already, do not dec the old surface texture reference. Otherwise segfault will occur. For bug 5327664. Do not merge." into ics-factoryrom
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index f16a029..c270f21 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -247,6 +247,11 @@
 static void
 decVideoSurfaceRef(JNIEnv *env, jobject thiz)
 {
+    sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
+    if (mp == NULL) {
+        return;
+    }
+
     sp<ISurfaceTexture> old_st = getVideoSurfaceTexture(env, thiz);
     if (old_st != NULL) {
         old_st->decStrong(thiz);