From 5628096e51f05f3b1b935dadf934f91a4928d018 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Sat, 28 Aug 2010 17:52:27 +0000 Subject: [PATCH] pitch_detector: avoid a division by zero when changing 'lowest frequency' setting git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27917 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/pitch_detector.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/plugins/pitch_detector.c b/apps/plugins/pitch_detector.c index b3003cd522..36e7059c1f 100644 --- a/apps/plugins/pitch_detector.c +++ b/apps/plugins/pitch_detector.c @@ -1143,7 +1143,11 @@ void init_everything(void) sample_rate = rb->rec_freq_sampr[sample_rate]; rb->pcm_set_frequency(sample_rate | SAMPR_TYPE_REC); rb->pcm_init_recording(); - + + /* avoid divsion by zero */ + if(tuner_settings.lowest_freq == 0) + tuner_settings.lowest_freq = period2freq(BUFFER_SIZE / 4); + /* GUI */ #if LCD_DEPTH > 1 front_color = rb->lcd_get_foreground(); -- 2.11.4.GIT