From 81164ef2dcde40331eb6431c28fb09cf09ed00c8 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Tue, 23 Nov 2021 11:27:56 +0100 Subject: [PATCH] Fixed NPE in AudioProcessingConfig when no NS level was set --- .../src/main/cpp/src/media/audio/AudioProcessingConfig.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webrtc-jni/src/main/cpp/src/media/audio/AudioProcessingConfig.cpp b/webrtc-jni/src/main/cpp/src/media/audio/AudioProcessingConfig.cpp index 94d8163..9a201d7 100644 --- a/webrtc-jni/src/main/cpp/src/media/audio/AudioProcessingConfig.cpp +++ b/webrtc-jni/src/main/cpp/src/media/audio/AudioProcessingConfig.cpp @@ -59,7 +59,12 @@ namespace jni config.level_estimation.enabled = levelEstimation.getBoolean(javaLevelEstimationClass->enabled); config.noise_suppression.enabled = noiseSuppression.getBoolean(javaNoiseSuppressionClass->enabled); - config.noise_suppression.level = jni::JavaEnums::toNative(env, noiseSuppression.getObject(javaNoiseSuppressionClass->level)); + + JavaLocalRef nsLevel = noiseSuppression.getObject(javaNoiseSuppressionClass->level); + + if (nsLevel.get()) { + config.noise_suppression.level = jni::JavaEnums::toNative(env, nsLevel); + } config.residual_echo_detector.enabled = residualEchoDetector.getBoolean(javaResidualEchoDetectorClass->enabled);