]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mood.c
mood: Add score value only for admissible files.
[paraslash.git] / mood.c
diff --git a/mood.c b/mood.c
index d9ae48bf967e61b0c4c0ca499d75f0b47eb47b96..d12bc20d77554c58a77b5b2da3b4a608e5309f34 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2011 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2007-2012 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -173,6 +173,8 @@ static int compute_mood_score(const struct osl_row *aft_row, struct mood *m,
        list_for_each_entry(item, &m->score_list, mood_item_node) {
                ret = get_item_score(item, &afsi, &afhi, path, &item_score,
                        &score_arg_sum);
+               if (ret == 0)
+                       continue;
                score += item_score;
        }
        if (score_arg_sum)
@@ -364,8 +366,10 @@ static int load_mood(const struct osl_row *mood_row, struct mood **m)
        char *mood_name;
        struct osl_object mood_def;
        struct mood_line_parser_data mlpd = {.line_num = 0};
-       int ret = mood_get_name_and_def_by_row(mood_row, &mood_name, &mood_def);
+       int ret;
 
+       *m = NULL;
+       ret = mood_get_name_and_def_by_row(mood_row, &mood_name, &mood_def);
        if (ret < 0)
                return ret;
        if (!*mood_name)