mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-14 10:13:13 +02:00
Have get_player return nil if no index/player
This commit is contained in:
parent
de87998299
commit
17af2498f8
@ -20,12 +20,11 @@ local function get_player(event)
|
|||||||
-- and indexing Game.players with nil is apparently an error.
|
-- and indexing Game.players with nil is apparently an error.
|
||||||
local player_index = event.player_index
|
local player_index = event.player_index
|
||||||
if not player_index then
|
if not player_index then
|
||||||
return false
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local player = Game.get_player_by_index(event.player_index)
|
local player = Game.get_player_by_index(event.player_index)
|
||||||
if not player or not player.valid then
|
if not player or not player.valid then
|
||||||
return false
|
return nil
|
||||||
end
|
end
|
||||||
return player
|
return player
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user