Skip to content

Commit 861e553

Browse files
committed
ANDROID: fix crash passing negative duration to SOUND command
1 parent 8c07670 commit 861e553

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2019-14-02 (0.12.15)
2+
ANDROID: fix crash passing negative duration to SOUND command
3+
14
2019-11-02 (0.12.15)
25
UI: ALT+F4 from edit/run now returns to edit
36
UI: avoid flicker from with ALT+F4 -e edit startup

src/platform/android/app/src/main/java/net/sourceforge/smallbasic/Sound.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void setSilent(boolean silent) {
5656
* http://stackoverflow.com/questions/2413426/playing-an-arbitrary-tone-with-android
5757
*/
5858
private byte[] generateTone(int freqOfTone, int durationMillis) {
59-
int numSamples = durationMillis * AUDIO_SAMPLE_RATE / 1000;
59+
int numSamples = Math.max(1, durationMillis * AUDIO_SAMPLE_RATE / 1000);
6060
double sample[] = new double[numSamples];
6161
byte result[] = new byte[2 * numSamples];
6262

0 commit comments

Comments
 (0)