diff --git a/changelog/snippets/fix.6467.md b/changelog/snippets/fix.6467.md new file mode 100644 index 0000000000..9a174e5f91 --- /dev/null +++ b/changelog/snippets/fix.6467.md @@ -0,0 +1 @@ +- (#6467) Fix a crash during blueprint loading if a unit blueprint has an enhancements table but not an intel table. diff --git a/lua/system/blueprints-units.lua b/lua/system/blueprints-units.lua index 6af989b396..628096df5b 100644 --- a/lua/system/blueprints-units.lua +++ b/lua/system/blueprints-units.lua @@ -395,17 +395,19 @@ local function PostProcessUnit(unit) -- usual case: find all remaining intel status.AllIntel = {} - for name, value in pairs(intelBlueprint) do - - -- may contain tables, such as `JamRadius` - if type(value) ~= 'table' then - if value == true or value > 0 then - local intel = BlueprintNameToIntel[name] - if intel and not activeIntel[intel] then - if allIntelIsFree then - status.AllIntelMaintenanceFree[intel] = true - else - status.AllIntel[intel] = true + if intelBlueprint then + for name, value in pairs(intelBlueprint) do + + -- may contain tables, such as `JamRadius` + if type(value) ~= 'table' then + if value == true or value > 0 then + local intel = BlueprintNameToIntel[name] + if intel and not activeIntel[intel] then + if allIntelIsFree then + status.AllIntelMaintenanceFree[intel] = true + else + status.AllIntel[intel] = true + end end end end