]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'maint'
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 24 Mar 2022 18:58:12 +0000 (19:58 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 24 Mar 2022 18:58:12 +0000 (19:58 +0100)
A single fix for a benign bug.

* maint:
  afs: Update dummy mood assumptions to reflect the reality.

afs.c
mood.c

diff --git a/afs.c b/afs.c
index e1639cc7c1447e0e9f31deff65f79fab1e3239e3..6d6e67e8d9cac880176da5609dd96e1fe3c9882c 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -447,7 +447,6 @@ no_admissible_files:
        return write_all(server_socket, buf, 8);
 }
 
-/* Never fails if arg == NULL */
 static int activate_mood_or_playlist(const char *arg, int *num_admissible,
                char **errmsg)
 {
@@ -455,8 +454,13 @@ static int activate_mood_or_playlist(const char *arg, int *num_admissible,
        int ret;
 
        if (!arg) {
-               ret = change_current_mood(NULL, NULL); /* always successful */
                mode = PLAY_MODE_MOOD;
+               ret = change_current_mood(NULL, errmsg);
+               if (ret < 0) {
+                       if (num_admissible)
+                               *num_admissible = 0;
+                       return ret;
+               }
        } else {
                if (!strncmp(arg, "p/", 2)) {
                        ret = playlist_open(arg + 2);
@@ -615,10 +619,10 @@ static void init_admissible_files(const char *arg)
 {
        int ret = activate_mood_or_playlist(arg, NULL, NULL);
        if (ret < 0) {
-               assert(arg);
                PARA_WARNING_LOG("could not activate %s: %s\n", arg,
                        para_strerror(-ret));
-               activate_mood_or_playlist(NULL, NULL, NULL);
+               if (arg)
+                       activate_mood_or_playlist(NULL, NULL, NULL);
        }
 }
 
diff --git a/mood.c b/mood.c
index fbc22297fd0df3a2d1fb5b7927fde5b1a7825315..a228b2432f9b56d3bc51535c13d74094314e7da9 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -607,8 +607,7 @@ static void compute_correction_factors(int64_t sse)
  *
  * If there is already an open mood, it will be closed first.
  *
- * \return Positive on success, negative on errors. Loading the dummy mood
- * always succeeds.
+ * \return Positive on success, negative on errors.
  *
  * \sa struct \ref afs_info::last_played, \ref mp_eval_row().
  */