Skip to content

Commit 994c552

Browse files
Copilotriccardobl
andauthored
Fix NPE in JmeAndroidSystem when audio renderer is disabled (#2670)
* Initial plan * Fix null audio renderer NPE in JmeAndroidSystem Agent-Logs-Url: https://github.com/jMonkeyEngine/jmonkeyengine/sessions/a0e02d04-8d68-4b0f-aab6-0cc86f24d418 Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com>
1 parent e36f800 commit 994c552

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ public void writeImageFile(OutputStream outStream, String format, ByteBuffer ima
7676

7777
@Override
7878
public JmeContext newContext(AppSettings settings, Type contextType) {
79-
if (settings.getAudioRenderer().equals(AppSettings.ANDROID_MEDIAPLAYER)) {
79+
if (settings.getAudioRenderer() == null) {
80+
audioRendererType = null;
81+
} else if (settings.getAudioRenderer().equals(AppSettings.ANDROID_MEDIAPLAYER)) {
8082
audioRendererType = AppSettings.ANDROID_MEDIAPLAYER;
8183
} else if (settings.getAudioRenderer().equals(AppSettings.ANDROID_OPENAL_SOFT)) {
8284
audioRendererType = AppSettings.ANDROID_OPENAL_SOFT;
@@ -92,6 +94,9 @@ public JmeContext newContext(AppSettings settings, Type contextType) {
9294

9395
@Override
9496
public AudioRenderer newAudioRenderer(AppSettings settings) {
97+
if (settings.getAudioRenderer() == null) {
98+
return null;
99+
}
95100
ALC alc = new AndroidALC();
96101
AL al = new AndroidAL();
97102
EFX efx = new AndroidEFX();

0 commit comments

Comments
 (0)