Skip to content

Commit

Permalink
Nokia: Sound: Don't return null in cases a command type is unknown
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AShiningRay committed Dec 7, 2024
1 parent b69a076 commit e5f85f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/com/nokia/mid/sound/Sound.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit e5f85f9

Please sign in to comment.