Skip to content

Commit d690481

Browse files
James DongAndroid (Google) Code Review
authored andcommitted
Merge "Throw an exception instead of crash when a surface does not have a binding surface texture" into jb-mr1-dev
2 parents b2eb028 + 097922b commit d690481

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

media/jni/android_media_MediaPlayer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface, jboolean mediaPlaye
274274
sp<Surface> surface(android_view_Surface_getSurface(env, jsurface));
275275
if (surface != NULL) {
276276
new_st = surface->getSurfaceTexture();
277+
if (new_st == NULL) {
278+
jniThrowException(env, "java/lang/IllegalArgumentException",
279+
"The surface does not have a binding SurfaceTexture!");
280+
return;
281+
}
277282
new_st->incStrong(thiz);
278283
} else {
279284
jniThrowException(env, "java/lang/IllegalArgumentException",

0 commit comments

Comments
 (0)