1
0
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:
Matthew Heguy 2018-11-26 10:50:06 -05:00
parent de87998299
commit 17af2498f8

View File

@ -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