From b3e68491e3965eb22ca5ace65c446da3e6a6f5c0 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 22 Jan 2021 14:49:57 -0800 Subject: Don't crash if the MediaCodecList is null. We need to avoid calling the JavaMediaCodecListWrapper constructor if the MediaCodecList is null because the constructor assumes its argument to be non-null. Since throwing a JNI exception does not implicitly return we need to return null to avoid entering the constructor. Change-Id: If473d2f6f219719ff81c29307637f28b7e31af77 --- media/jni/android_media_MediaCodecList.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'media') diff --git a/media/jni/android_media_MediaCodecList.cpp b/media/jni/android_media_MediaCodecList.cpp index 307d80dc15c0..07866ac34e4c 100644 --- a/media/jni/android_media_MediaCodecList.cpp +++ b/media/jni/android_media_MediaCodecList.cpp @@ -105,6 +105,7 @@ static const JavaMediaCodecListWrapper *getCodecList(JNIEnv *env) { // This should never happen unless something is really wrong jniThrowException( env, "java/lang/RuntimeException", "cannot get MediaCodecList"); + return NULL; } sListWrapper.reset(new JavaMediaCodecListWrapper(mcl)); -- cgit v1.2.3