Skip to content

Commit

Permalink
Fix invalid spidertron crash
Browse files Browse the repository at this point in the history
  • Loading branch information
tburrows13 committed May 27, 2022
1 parent 0b3c5be commit b5922ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog.txt
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 1.8.5
Date: 17 May 2022
Bugfixes:
- Fixed crash when removing spidertron after issuing a pathfind command
---------------------------------------------------------------------------------------------------
Version: 1.8.4
Date: 3 May 2022
Features:
Expand Down
5 changes: 3 additions & 2 deletions scripts/pathfinder.lua
Expand Up @@ -93,10 +93,11 @@ script.on_event(defines.events.on_script_path_request_finished,
local request_info = global.pathfinder_requests[event.id]
if request_info then
local spidertron = request_info.spidertron
local total_legs = #spidertron.get_spider_legs()
local total_path_requests = math.floor(total_legs / 2) + (total_legs % 2)
local player = request_info.player
if spidertron.valid and player.valid then
local total_legs = #spidertron.get_spider_legs()
local total_path_requests = math.floor(total_legs / 2) + (total_legs % 2)

local start_position = request_info.start_position
local target_position = request_info.target_position
local clicked_position = request_info.clicked_position
Expand Down

0 comments on commit b5922ae

Please sign in to comment.