diff options
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -76,10 +76,26 @@ local function add_object(obj) obj.children = {} end - if not obj.parent_id or not objects[obj.parent_id] then + if not obj.parent_id then return end + -- dump any objects referencing nonexistent categories into a single + -- catchall category + if not objects[obj.parent_id] then + obj.parent_id = obj.section .. ':category:catchall' + if not objects[obj.parent_id] then + add_object({ + section=obj.section, + type='group', + group_type='category', + id=obj.parent_id, + parent_id=obj.section .. ':category:0', + name='*CATCHALL*', + }) + end + end + local parent_children = objects[obj.parent_id].children parent_children[#parent_children+1] = obj end |