commit bdc79c7ecede269770677d3645ba27a521b673eb parent 9071e7aaf3a12ea712e22d17d261b51766d9f7f6 Author: sin <sin@2f30.org> Date: Thu, 25 Dec 2014 15:25:19 +0000 Reset state on failure Diffstat:
M | sad.c | | | 7 | +++++-- |
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sad.c b/sad.c @@ -70,11 +70,14 @@ doaudio(void) switch (s->state) { case PREPARE: - decoder->open(s->path); + if (decoder->open(s->path) < 0) { + s->state = NONE; + return; + } s->state = PLAYING; break; case PLAYING: - if (decoder->decode() == 0) { + if (decoder->decode() <= 0) { decoder->close(); s->state = NONE; }