diff --git a/src/CommNetConstellation/CommNetLayer/CNCCommNetHome.cs b/src/CommNetConstellation/CommNetLayer/CNCCommNetHome.cs index 1e58077..fe415a6 100644 --- a/src/CommNetConstellation/CommNetLayer/CNCCommNetHome.cs +++ b/src/CommNetConstellation/CommNetLayer/CNCCommNetHome.cs @@ -389,6 +389,19 @@ protected void regenerateFrequencyArray(List list) /// protected void refresh() { + if (this.comm == null) + { + if (!HighLogic.CurrentGame.Parameters.CustomParams().enableGroundStations) + { + CNCLog.Verbose("Ground station '{0}': CommNet option of enabling ground stations is disabled", this.ID); + } + else + { + CNCLog.Verbose("Ground station '{0}': Null CommNode, likely due to a third-party CommNet mod", this.ID); + } + return; + } + // Obtain Tech Level of Tracking Station in KCS if (this.isKSC) { @@ -396,10 +409,7 @@ protected void refresh() } // Update power of ground station - if (this.comm != null) - { - this.comm.antennaRelay.Update(GetDSNRange(this.TechLevel), GameVariables.Instance.GetDSNRangeCurve(), false); - } + this.comm.antennaRelay.Update(GetDSNRange(this.TechLevel), GameVariables.Instance.GetDSNRangeCurve(), false); // Generate ground station information stationInfoString = (this.TechLevel == 0) ? "Build a ground station" : @@ -412,21 +422,7 @@ protected void refresh() stationTexture = CNCCommNetHome.getGroundStationTexture(this.TechLevel); // Update position on celestial body - if (this.comm != null) - { - if (this.body != null) - { - this.comm.precisePosition = this.body.GetWorldSurfacePosition(this.latitude, this.longitude, this.altitude); - } - else - { - CNCLog.Verbose("Body of CommNetHome is null"); - } - } - else - { - CNCLog.Verbose("CommNode of CommNetHome is null, likely due to a third-party CommNet mod"); - } + this.comm.precisePosition = this.body.GetWorldSurfacePosition(this.latitude, this.longitude, this.altitude); } ///