]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
mixer: fade: Handle empty mood strings gracefully.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 1 Sep 2019 08:20:37 +0000 (10:20 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 2 Nov 2019 15:53:55 +0000 (16:53 +0100)
Treat them as if the option was not given to prevent "para_client
select" to fail.

mixer.c

diff --git a/mixer.c b/mixer.c
index efa42b93efb9ce0cf6f277b0f117806845455a26..b14bb76ebe150864ae261da3c668c0be885e2f74 100644 (file)
--- a/mixer.c
+++ b/mixer.c
@@ -288,7 +288,7 @@ static int com_sleep(const struct mixer *m, struct mixer_handle *h)
        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;
@@ -305,13 +305,13 @@ static int com_sleep(const struct mixer *m, struct mixer_handle *h)
                if (ret < 0)
                        return ret;
        }
-       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 */
+       if (!fit || !fi_mood || !*fi_mood) /* nothing to do */
                return 1;
        for (;;) {
                time(&t1);
@@ -324,7 +324,7 @@ static int com_sleep(const struct mixer *m, struct mixer_handle *h)
                sleep(delay);
        }
        change_afs_mode(fi_mood);
-       if (sleep_mood) /* currently playing */
+       if (sleep_mood && *sleep_mood) /* currently playing */
                client_cmd("next");
        else /* currently stopped */
                client_cmd("play");