From 097922b9c1e0821beb107024bcd0dc14144c0920 Mon Sep 17 00:00:00 2001 From: James Dong Date: Thu, 4 Oct 2012 09:16:40 -0700 Subject: Throw an exception instead of crash when a surface does not have a binding surface texture o related-to-bug: 7270329 Change-Id: I498d72187968e89d9498d01b10719569e12be2af --- media/jni/android_media_MediaPlayer.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'media/jni') diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp index 04ba348..ad536f2 100644 --- a/media/jni/android_media_MediaPlayer.cpp +++ b/media/jni/android_media_MediaPlayer.cpp @@ -274,6 +274,11 @@ setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface, jboolean mediaPlaye sp surface(android_view_Surface_getSurface(env, jsurface)); if (surface != NULL) { new_st = surface->getSurfaceTexture(); + if (new_st == NULL) { + jniThrowException(env, "java/lang/IllegalArgumentException", + "The surface does not have a binding SurfaceTexture!"); + return; + } new_st->incStrong(thiz); } else { jniThrowException(env, "java/lang/IllegalArgumentException", -- cgit v1.1