Skip to content

Commit

Permalink
fixed crash, when using script_built and script_revive
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxfighter committed Jan 23, 2020
1 parent df8878f commit 1200a7c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version: 2.0.1
Date: 23.01.2020
Bugfix:
- Fixed crash when calling script_raised_built or script_raised_revive
---------------------------------------------------------------------------------------------------
Version: 2.0.0
Date: 21.01.2020
Breaking changes:
Expand Down
13 changes: 11 additions & 2 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,21 @@ script.on_event({
defines.events.script_raised_revive
},
function(e)
---@type LuaEntity
local entity

if e.entity then
entity = e.entity
else
entity = e.created_entity
end

if type(global.train_stops) ~= "table" then
global.train_stops = {}
end

if e.created_entity.prototype.type == "train-stop" then
insert_sorted(e.created_entity)
if entity.prototype.type == "train-stop" then
insert_sorted(entity)

refresh_all_guis()
end
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "train-station-overview",
"version": "2.0.0",
"version": "2.0.1",
"title": "Train Station Overview",
"author": "knoxfighter",
"contact": "[email protected]",
Expand Down

0 comments on commit 1200a7c

Please sign in to comment.