Skip to content

Commit a674e04

Browse files
committed
Fixed KeyNotFoundException
The problem is that the `v.loaded` on the `GetSignalProcessor` method is still true after the vesselOnRails event. Thats why i also check the `part.count` like we do this on the `SatelliteManager.OnVesselOnRails` method.
1 parent e0e4106 commit a674e04

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/RemoteTech/SatelliteManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public static bool IsSignalProcessor(this PartModule pm)
209209
public static ISignalProcessor GetSignalProcessor(this Vessel v)
210210
{
211211
RTLog.Notify("GetSignalProcessor({0}): Check", v.vesselName);
212-
if (v.loaded)
212+
if (v.loaded && v.parts.Count > 0)
213213
{
214214
foreach (PartModule pm in v.Parts.SelectMany(p => p.Modules.Cast<PartModule>()).Where(pm => pm.IsSignalProcessor()))
215215
{
@@ -242,7 +242,7 @@ public static bool IsCommandStation(this PartModule pm)
242242
public static bool HasCommandStation(this Vessel v)
243243
{
244244
RTLog.Notify("HasCommandStation({0})", v.vesselName);
245-
if (v.loaded)
245+
if (v.loaded && v.parts.Count > 0)
246246
{
247247
return v.Parts.SelectMany(p => p.Modules.Cast<PartModule>()).Any(pm => pm.IsCommandStation());
248248
}

0 commit comments

Comments
 (0)