# HG changeset patch # User James D. Callahan III # Date 1369064598 18000 # Node ID 43a058bd38e0046a30aaed781565a1fbfd085d76 # Parent d841c44553d5cd6c0f27f65bc0b3eba560541fe0 Robustified DBEntry() diff -r d841c44553d5 -r 43a058bd38e0 Main.lua --- a/Main.lua Wed May 15 20:15:40 2013 -0500 +++ b/Main.lua Mon May 20 10:43:18 2013 -0500 @@ -296,11 +296,17 @@ if not data_type or not unit_id then return end - local unit = global_db[data_type][unit_id] + local category = global_db[data_type] + + if not category then + category = {} + global_db[data_type] = category + end + local unit = category[unit_id] if not unit then unit = {} - global_db[data_type][unit_id] = unit + category[unit_id] = unit end return unit end