From e68323325b398eee98d5c81a6024d377ebc48bc1 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 13 Jul 2012 13:01:06 +0300 Subject: mediacodec: Don't crash if trying to open a codec that does not exist Change-Id: If75e3156517993629f50622a84a9ac573fced815 --- media/jni/android_media_MediaCodec.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'media') diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index e43e66e..4941ae5 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -96,7 +96,10 @@ status_t JMediaCodec::initCheck() const { } JMediaCodec::~JMediaCodec() { - mCodec->release(); + if (mCodec != NULL) { + mCodec->release(); + mCodec.clear(); + } JNIEnv *env = AndroidRuntime::getJNIEnv(); -- cgit v1.1