fix crash when renaming server while connected to that server (#438)

This commit is contained in:
Snarling 2023-03-21 21:21:15 -04:00 committed by GitHub
parent 39d26673c4
commit a774592e64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,6 +68,7 @@ export const renamePurchasedServer = (hostname: string, newName: string): void =
return arr.map((v) => (v === old ? next : v));
};
Player.purchasedServers = replace(Player.purchasedServers, hostname, newName);
if (Player.currentServer === hostname) Player.currentServer = newName;
const home = Player.getHomeComputer();
home.serversOnNetwork = replace(home.serversOnNetwork, hostname, newName);
server.serversOnNetwork = replace(server.serversOnNetwork, hostname, newName);