Formal protocol for the interface shared between Joysticks and JSActions, use new...
[enjoyable.git] / Config.m
index a02c4ce..046ccc2 100644 (file)
--- a/Config.m
+++ b/Config.m
@@ -13,7 +13,7 @@
 
 - (id)initWithName:(NSString *)name {
     if ((self = [super init])) {
-        self.name = name;
+        self.name = name ? name : @"Untitled";
         _entries = [[NSMutableDictionary alloc] init];
     }
     return self;
 
 - (NSDictionary *)serialize {
     NSMutableDictionary* cfgEntries = [[NSMutableDictionary alloc] initWithCapacity:_entries.count];
-    for (id key in _entries)
-        cfgEntries[key] = [_entries[key] serialize];
+    for (id key in _entries) {
+        id serialized = [_entries[key] serialize];
+        if (serialized)
+            cfgEntries[key] = serialized;
+    }
     return @{ @"name": _name, @"entries": cfgEntries };
 }