From d891f75e6ca1cae886703edd70bf3dd36bc82ae9 Mon Sep 17 00:00:00 2001 From: Oarcinae Date: Tue, 22 Oct 2024 20:47:40 -0400 Subject: [PATCH] Fixing crash in player list. Also bumping version. --- changelog.txt | 5 +++++ info.json | 2 +- lib/gui_tabs/player_list.lua | 11 ++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index a1bfafe..fac14a0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 2.1.1 +Date: 2024-10-23 + Bugfixes: + - Fix a crash when clicking on player location in player list. +--------------------------------------------------------------------------------------------------- Version: 2.1.0 Date: 2024-10-22 Major Features: diff --git a/info.json b/info.json index e91f499..860c24b 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "oarc-mod", - "version": "2.1.0", + "version": "2.1.1", "factorio_version": "2.0", "title": "Oarc Multiplayer Spawn", "author": "Oarcinae", diff --git a/lib/gui_tabs/player_list.lua b/lib/gui_tabs/player_list.lua index bf8bb46..d98fef1 100644 --- a/lib/gui_tabs/player_list.lua +++ b/lib/gui_tabs/player_list.lua @@ -123,6 +123,15 @@ function PlayerListTabGuiClick(event) local player_name = tags.player_name --[[@as string]] local target_player = game.players[player_name] - player.set_controller{type = defines.controllers.remote, position = target_player.character.position, surface = target_player.character.surface} + if (target_player == nil) then + player.print({"oarc-player-not-found", player_name}) + return + end + + if (target_player.character) then + player.set_controller{type = defines.controllers.remote, position = target_player.character.position, surface = target_player.character.surface} + else + player.set_controller{type = defines.controllers.remote, position = target_player.position, surface = target_player.surface} + end end end \ No newline at end of file