Merge branch 'master' into next
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 23 Nov 2019 17:22:25 +0000 (18:22 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 23 Nov 2019 17:22:25 +0000 (18:22 +0100)
* master:
  mixer: fade: Handle empty mood strings gracefully.

1  2 
mixer.c

diff --cc mixer.c
+++ b/mixer.c
@@@ -318,10 -288,10 +318,10 @@@ static int com_sleep(const struct mixe
        PARA_INFO_LOG("waketime: %d:%02d\n", tm->tm_hour, tm->tm_min);
        client_cmd("stop");
        sleep(1);
-       if (fot && fo_mood) {
+       if (fot && fo_mood && *fo_mood) {
                ret = set_initial_volume(m, h);
                if (ret < 0)
 -                      return ret;
 +                      goto close_mixer;
                change_afs_mode(fo_mood);
                client_cmd("play");
                ret = set_channel(m, h, OPT_STRING_VAL(PARA_MIXER, MIXER_CHANNEL));
        } else {
                ret = m->set(h, fov);
                if (ret < 0)
 -                      return ret;
 +                      goto close_mixer;
        }
-       if (sleep_mood) {
+       if (sleep_mood && *sleep_mood) {
                change_afs_mode(sleep_mood);
                if (!fot || !fo_mood) /* currently stopped */
                        client_cmd("play");
-       } else if (fot && fo_mood) /* currently playing */
+       } else if (fot && fo_mood && *fo_mood) /* currently playing */
                client_cmd("stop");
-       if (!fit || !fi_mood) /* nothing to do */
 +      m->close(&h);
+       if (!fit || !fi_mood || !*fi_mood) /* nothing to do */
                return 1;
        for (;;) {
                time(&t1);