[libgames-support] scores: Tolerate some messiness in the CategoryConvertFunc



commit 5649f53c69cef6b8dc043b075df6939b3c72e51b
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Feb 13 19:32:29 2016 -0600

    scores: Tolerate some messiness in the CategoryConvertFunc
    
    If the CategoryConvertFunc does not closely examine the values it
    receives -- say, if it's a test function that always returns the same
    category -- then bad things will happen when it is passed the "scores"
    category, corresponding to the new directory created by this function.
    There is no sensible thing a game could ever do with this besides to
    return null, so just skip it.

 games/scores/directory-importer.vala |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/games/scores/directory-importer.vala b/games/scores/directory-importer.vala
index aae1b23..68a5100 100644
--- a/games/scores/directory-importer.vala
+++ b/games/scores/directory-importer.vala
@@ -64,6 +64,10 @@ public class DirectoryImporter : Importer
         FileInfo file_info;
         while ((file_info = enumerator.next_file ()) != null)
         {
+            /* We just created this.... */
+            if (file_info.get_name () == "scores")
+                continue;
+
             var new_key = category_convert (file_info.get_name ());
             if (new_key == null)
                 continue;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]