Skip to content

Commit

Permalink
Fix a crash if a unit has an enhancements table but not an intel table (
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Balthazar authored Oct 12, 2024
1 parent a900390 commit 6261cc0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions changelog/snippets/fix.6467.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- (#6467) Fix a crash during blueprint loading if a unit blueprint has an enhancements table but not an intel table.
24 changes: 13 additions & 11 deletions lua/system/blueprints-units.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6261cc0

Please sign in to comment.