Relicensed to Modified BSD.
[VOID.git] / VOID_Orbital.cs
blob:a/VOID_Orbital.cs -> blob:b/VOID_Orbital.cs
--- a/VOID_Orbital.cs
+++ b/VOID_Orbital.cs
@@ -129,7 +129,14 @@
 	{
 		public static readonly VOID_StrValue primaryName = new VOID_StrValue (
 			VOID_Localization.void_primary,
-			new Func<string> (() => VOID_Core.Instance.vessel.mainBody.name)
+			delegate()
+		{
+			if (VOID_Core.Instance.vessel == null)
+			{
+				return string.Empty;
+			}
+			return VOID_Core.Instance.vessel.mainBody.name;
+		}
 		);
 
 		public static readonly VOID_DoubleValue orbitAltitude = new VOID_DoubleValue (
@@ -158,12 +165,12 @@
 
 		public static readonly VOID_StrValue timeToApo = new VOID_StrValue(
 			"Time to Apoapsis",
-			new Func<string>(() => Tools.ConvertInterval(VOID_Core.Instance.vessel.orbit.timeToAp))
+			new Func<string>(() => VOID_Tools.ConvertInterval(VOID_Core.Instance.vessel.orbit.timeToAp))
 		);
 
 		public static readonly VOID_StrValue timeToPeri = new VOID_StrValue(
 			"Time to Periapsis",
-			new Func<string>(() => Tools.ConvertInterval(VOID_Core.Instance.vessel.orbit.timeToPe))
+			new Func<string>(() => VOID_Tools.ConvertInterval(VOID_Core.Instance.vessel.orbit.timeToPe))
 		);
 
 		public static readonly VOID_DoubleValue orbitInclination = new VOID_DoubleValue(
@@ -186,7 +193,7 @@
 
 		public static readonly VOID_StrValue orbitPeriod = new VOID_StrValue(
 			"Period",
-			new Func<string>(() => Tools.ConvertInterval(VOID_Core.Instance.vessel.orbit.period))
+			new Func<string>(() => VOID_Tools.ConvertInterval(VOID_Core.Instance.vessel.orbit.period))
 		);
 
 		public static readonly VOID_DoubleValue semiMajorAxis = new VOID_DoubleValue(
@@ -233,7 +240,7 @@
 
 		public static readonly VOID_DoubleValue localSiderealLongitude = new VOID_DoubleValue(
 			"Local Sidereal Longitude",
-			new Func<double>(() => Tools.FixDegreeDomain(
+			new Func<double>(() => VOID_Tools.FixDegreeDomain(
 				VOID_Core.Instance.vessel.longitude + VOID_Core.Instance.vessel.orbit.referenceBody.rotationAngle)),
 			"°"
 		);