summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 3cb55ec..fd6f75b 100644
--- a/main.lua
+++ b/main.lua
@@ -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