From 9d653056a65fab4b358477aa1eed11a2f907d8e1 Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Fri, 28 Jan 2022 08:41:39 -0800 Subject: [PATCH] Fix nullptr check We assume the function argument is non-null (otherwise we would have crashed by this point). What we really want to check here is the result of the subfunction we've called, so we fix the code to do that. Test: TreeHugger Bug: 190810951 Change-Id: I4f979c98f90b772527b270d51a25dcbfd8b122a2 --- core/jni/android_media_AudioSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp index e13b78868a2c4..6b82ba80a26ab 100644 --- a/core/jni/android_media_AudioSystem.cpp +++ b/core/jni/android_media_AudioSystem.cpp @@ -1288,7 +1288,7 @@ static jint convertAudioProfileFromNative(JNIEnv *env, jobject *jAudioProfile, audioFormatFromNative(nAudioProfile->format), jSamplingRates.get(), jChannelMasks.get(), jChannelIndexMasks.get(), encapsulationType); - if (jAudioProfile == nullptr) { + if (*jAudioProfile == nullptr) { return AUDIO_JAVA_ERROR; }