Skip to content

Commit 097922b

Browse files
author
James Dong
committed
Throw an exception instead of crash when a surface does not have a binding surface texture
o related-to-bug: 7270329 Change-Id: I498d72187968e89d9498d01b10719569e12be2af
1 parent 31fed73 commit 097922b

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)