summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMartin Scarratt <mmmm@rockbox.org>2006-09-13 18:21:03 +0000
committerMartin Scarratt <mmmm@rockbox.org>2006-09-13 18:21:03 +0000
commit3ad2c5ad38f6be1342fdd6a38cf5c2240eff77ad (patch)
treeb728d1196c9af51b95b7ce79329b56cbc9c452a6 /apps
parent17e1e690c98ffcfb0726d30b9a0898e603e99d0c (diff)
downloadrockbox-3ad2c5ad38f6be1342fdd6a38cf5c2240eff77ad.tar.gz
rockbox-3ad2c5ad38f6be1342fdd6a38cf5c2240eff77ad.tar.bz2
rockbox-3ad2c5ad38f6be1342fdd6a38cf5c2240eff77ad.zip
Fix a possible division by zero which caused much "IO5: at 310205A0" type angst while recording
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10941 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/recorder/recording.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 41af72fefa..6ee71d2eee 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -195,11 +195,11 @@ bool read_peak_levels(int *peak_l, int *peak_r, int *balance)
return false;
if (*peak_r > *peak_l)
- balance_mem[peak_time % BAL_MEM_SIZE] =
- MIN((10000 * *peak_r) / *peak_l - 10000, 15118);
+ balance_mem[peak_time % BAL_MEM_SIZE] = (*peak_l ?
+ MIN((10000 * *peak_r) / *peak_l - 10000, 15118) : 15118);
else
- balance_mem[peak_time % BAL_MEM_SIZE] =
- MAX(10000 - (10000 * *peak_l) / *peak_r, -15118);
+ balance_mem[peak_time % BAL_MEM_SIZE] = (*peak_r ?
+ MAX(10000 - (10000 * *peak_l) / *peak_r, -15118) : -15118);
*balance = 0;
int i;
for (i = 0; i < BAL_MEM_SIZE; i++)