Fix ResearchSystem threading exception (#40917)
* Fix ResearchSystem threading exception * Update Content.Server/Research/Systems/ResearchSystem.Client.cs --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Research.Components;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Research.Systems;
|
||||
|
||||
@@ -62,10 +63,8 @@ public sealed partial class ResearchSystem
|
||||
|
||||
private void OnClientMapInit(EntityUid uid, ResearchClientComponent component, MapInitEvent args)
|
||||
{
|
||||
var allServers = GetServers(uid).ToList();
|
||||
|
||||
if (allServers.Count > 0)
|
||||
RegisterClient(uid, allServers[0], component, allServers[0]);
|
||||
if (GetServers(uid).FirstOrNull() is { } server)
|
||||
RegisterClient(uid, server, component, server);
|
||||
}
|
||||
|
||||
private void OnClientShutdown(EntityUid uid, ResearchClientComponent component, ComponentShutdown args)
|
||||
@@ -85,10 +84,8 @@ public sealed partial class ResearchSystem
|
||||
if (ent.Comp.Server is not null)
|
||||
return;
|
||||
|
||||
var allServers = GetServers(ent).ToList();
|
||||
|
||||
if (allServers.Count > 0)
|
||||
RegisterClient(ent, allServers[0], ent, allServers[0]);
|
||||
if (GetServers(ent).FirstOrNull() is { } server)
|
||||
RegisterClient(ent, server, ent, server);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user