Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a crash if a unit has an enhancements table but not an intel table #6467

Merged
merged 4 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading