summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2014-07-14 12:02:21 -0700
committerEino-Ville Talvala <etalvala@google.com>2014-07-14 12:02:21 -0700
commit6a5b1db177b71970a2d00eb6d24b8317914eab29 (patch)
treedf050bdc0acc3217a709de9d97447920fca9246b /media
parentfbff4891678e3667db48517ebd3559ca52dbe1bc (diff)
downloadframeworks_base-6a5b1db177b71970a2d00eb6d24b8317914eab29.zip
frameworks_base-6a5b1db177b71970a2d00eb6d24b8317914eab29.tar.gz
frameworks_base-6a5b1db177b71970a2d00eb6d24b8317914eab29.tar.bz2
MediaRecorder: Fix crash when given a released Camera object
Bug: 15617637 Change-Id: I420ecc3f7b946dcf705cf210a7d493290f838f09
Diffstat (limited to 'media')
-rw-r--r--media/jni/android_media_MediaRecorder.cpp4
1 files changed, 4 insertions, 0 deletions
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<Camera> c = get_native_camera(env, camera, NULL);
+ if (c == NULL) {
+ // get_native_camera will throw an exception in this case
+ return;
+ }
sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
process_media_recorder_call(env, mr->setCamera(c->remote(), c->getRecordingProxy()),
"java/lang/RuntimeException", "setCamera failed.");