From: Andre Noll <maan@systemlinux.org>
Date: Sun, 6 Sep 2009 20:23:45 +0000 (+0200)
Subject: mood: Do not handle events if no mood is active.
X-Git-Tag: v0.3.5~4
X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=37f4717467d2235dba5fe403737eba66efb1dde4;p=paraslash.git

mood: Do not handle events if no mood is active.

In case a file is being removed with "para_client rm" while in playlist mode,
the following assertion triggers:

	mood.c:521: del_afs_statistics: Assertion `n' failed.

This happens because the file is contained in the score table but statistics are not enabled.
Fix it by ignoring events if cuurent_mood is NULL.
---

diff --git a/mood.c b/mood.c
index 24d1de29..9f1d7745 100644
--- a/mood.c
+++ b/mood.c
@@ -1059,7 +1059,9 @@ int reload_current_mood(void)
 int moods_event_handler(enum afs_events event, __a_unused struct para_buffer *pb,
 		void *data)
 {
-	switch(event) {
+	if (!current_mood)
+		return 0;
+	switch (event) {
 	/*
 	 * The three blob events might change the set of admissible files,
 	 * so we must reload the score list.