From 6a5b1db177b71970a2d00eb6d24b8317914eab29 Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Mon, 14 Jul 2014 12:02:21 -0700 Subject: MediaRecorder: Fix crash when given a released Camera object Bug: 15617637 Change-Id: I420ecc3f7b946dcf705cf210a7d493290f838f09 --- media/jni/android_media_MediaRecorder.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'media') diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp index 1685a44..5646740 100644 --- a/media/jni/android_media_MediaRecorder.cpp +++ b/media/jni/android_media_MediaRecorder.cpp @@ -157,6 +157,10 @@ static void android_media_MediaRecorder_setCamera(JNIEnv* env, jobject thiz, job return; } sp c = get_native_camera(env, camera, NULL); + if (c == NULL) { + // get_native_camera will throw an exception in this case + return; + } sp mr = getMediaRecorder(env, thiz); process_media_recorder_call(env, mr->setCamera(c->remote(), c->getRecordingProxy()), "java/lang/RuntimeException", "setCamera failed."); -- cgit v1.1