summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-02-12 10:16:48 +0100
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-02-12 10:16:48 +0100
commit9c767e7ef973e6f75818f80b8e42f96ce13c4979 (patch)
tree18d448825d27e33e5588a12f206b10c2d557541b
parentb27163360b463f16715f9fd72ca8817fad3d2d46 (diff)
downloadpianobar-windows-9c767e7ef973e6f75818f80b8e42f96ce13c4979.tar.gz
pianobar-windows-9c767e7ef973e6f75818f80b8e42f96ce13c4979.tar.bz2
pianobar-windows-9c767e7ef973e6f75818f80b8e42f96ce13c4979.zip
(Hopfully) fix FPE -- again
Commit fcb1d460d459242dc30d033305db2cb9bf313f5e did only half of the work. Commit a2aee035072a5d346c187a890539f72c6d5167a0 introduced another division by zero.
-rw-r--r--src/main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index c08fc57..4f63404 100644
--- a/src/main.c
+++ b/src/main.c
@@ -126,7 +126,8 @@ int main (int argc, char **argv) {
scrobbleSong.length = player.songDuration / BAR_PLAYER_MS_TO_S_FACTOR;
/* scrobble when >= nn% are played; use seconds, not
* milliseconds */
- if (player.songPlayed / BAR_PLAYER_MS_TO_S_FACTOR * 100 /
+ if (scrobbleSong.length > 0 &&
+ player.songPlayed / BAR_PLAYER_MS_TO_S_FACTOR * 100 /
scrobbleSong.length >= settings.lastfmScrobblePercent &&
settings.enableScrobbling) {
WardrobeReturn_t wRet;