Skip to content

Commit

Permalink
Factorio: Fix ap-get-technology nil value crashes (ArchipelagoMW#3517)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaitSith2 authored Jul 28, 2024
1 parent 67f329b commit ab09036
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion worlds/factorio/data/mod_template/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,18 @@ commands.add_command("ap-get-technology", "Grant a technology, used by the Archi
end
local tech
local force = game.forces["player"]
if call.parameter == nil then
game.print("ap-get-technology is only to be used by the Archipelago Factorio Client")
return
end
chunks = split(call.parameter, "\t")
local item_name = chunks[1]
local index = chunks[2]
local source = chunks[3] or "Archipelago"
if index == -1 then -- for coop sync and restoring from an older savegame
if index == nil then
game.print("ap-get-technology is only to be used by the Archipelago Factorio Client")
return
elseif index == -1 then -- for coop sync and restoring from an older savegame
tech = force.technologies[item_name]
if tech.researched ~= true then
game.print({"", "Received [technology=" .. tech.name .. "] as it is already checked."})
Expand Down

0 comments on commit ab09036

Please sign in to comment.