From e5f85f9d1b0403d2429b0fb6d10d6c07e6262ec3 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sat, 7 Dec 2024 18:25:34 -0300 Subject: [PATCH] Nokia: Sound: Don't return null in cases a command type is unknown Some OTA/OTT tones are buggy and this is bound to happen. We can just break out of the loop, as the tones might have been parsed, even if partially. Such is the case of Ice Age's Nokia 3410 version. Instead of crashing FreeJ2ME, it can now be played fine, although sound can't be configured on the settings yet due to LCDUI being barebones. --- src/com/nokia/mid/sound/Sound.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/nokia/mid/sound/Sound.java b/src/com/nokia/mid/sound/Sound.java index 24fba5d0..763afa46 100644 --- a/src/com/nokia/mid/sound/Sound.java +++ b/src/com/nokia/mid/sound/Sound.java @@ -227,13 +227,13 @@ public static byte[] convertToMidi(byte[] data) throws MidiUnavailableException, break; case 0b00001010: // Cancel command, Does any actual OTT/OTA ringtone use this? Mobile.log(Mobile.LOG_WARNING, Sound.class.getPackage().getName() + "." + Sound.class.getSimpleName() + ": " + "Cancel command detected."); - return null; + break; case 0b00000000: // This should happen at the end of every parsing procedure. Mobile.log(Mobile.LOG_DEBUG, Sound.class.getPackage().getName() + "." + Sound.class.getSimpleName() + ": " + "End of ringtone programming!"); break; - default: // If this is the case, we can't parse the header, so just return null outright + default: // If this is the case, we can't parse the header, so just return outright Mobile.log(Mobile.LOG_ERROR, Sound.class.getPackage().getName() + "." + Sound.class.getSimpleName() + ": " + "Unknown command type: " + Integer.toBinaryString(commandType)); - return null; + break; } }