mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +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.
|
||||
local player_index = event.player_index
|
||||
if not player_index then
|
||||
return false
|
||||
return nil
|
||||
end
|
||||
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
if not player or not player.valid then
|
||||
return false
|
||||
return nil
|
||||
end
|
||||
return player
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user