diff --git a/src/RemoteTech2/NetworkManager.cs b/src/RemoteTech2/NetworkManager.cs index 84f8499..e44ef84 100644 --- a/src/RemoteTech2/NetworkManager.cs +++ b/src/RemoteTech2/NetworkManager.cs @@ -108,12 +108,14 @@ public void FindPath(ISatellite start, IEnumerable commandStations) public IEnumerable> FindNeighbors(ISatellite s) { - if (!s.Powered) return Enumerable.Empty>(); + if (!s.Powered || !Graph.ContainsKey(s.Guid)) return Enumerable.Empty>(); return Graph[s.Guid].Where(l => l.Target.Powered); } private void UpdateGraph(ISatellite a) { + if (!Graph.ContainsKey(a.Guid)) return; + var result = new List>(); foreach (ISatellite b in this) diff --git a/src/RemoteTech2/VesselSatellite.cs b/src/RemoteTech2/VesselSatellite.cs index fd3638a..3f355e5 100644 --- a/src/RemoteTech2/VesselSatellite.cs +++ b/src/RemoteTech2/VesselSatellite.cs @@ -8,7 +8,7 @@ namespace RemoteTech public class VesselSatellite : ISatellite { public bool Visible { - get { return SignalProcessor.Visible; } + get { return SignalProcessor != null ? SignalProcessor.Visible : false; } } public String Name { @@ -43,7 +43,7 @@ public ISignalProcessor SignalProcessor get { return RTUtil.CachePerFrame(ref mSignalProcessor, () => { - return SignalProcessors.FirstOrDefault(s => s.FlightComputer != null) ?? SignalProcessors[0]; + return SignalProcessors.FirstOrDefault(s => s.FlightComputer != null) ?? SignalProcessors.FirstOrDefault(); }); } }