Added comment and set initial assignment for the ShowEngineer and ControlBar toggle references to null.
[VesselSimulator.git] / KerbalEngineer.Unity / Flight / FlightEngineerMenu.cs
blob:a/KerbalEngineer.Unity/Flight/FlightEngineerMenu.cs -> blob:b/KerbalEngineer.Unity/Flight/FlightEngineerMenu.cs
--- a/KerbalEngineer.Unity/Flight/FlightEngineerMenu.cs
+++ b/KerbalEngineer.Unity/Flight/FlightEngineerMenu.cs
@@ -26,10 +26,10 @@
     public class FlightEngineerMenu : CanvasGroupFader, IPointerEnterHandler, IPointerExitHandler
     {
         [SerializeField]
-        private Toggle m_ShowEngineerToggle;
+        private Toggle m_ShowEngineerToggle = null;
 
         [SerializeField]
-        private Toggle m_ControlBarToggle;
+        private Toggle m_ControlBarToggle = null;
 
         [SerializeField]
         private float m_FastFadeDuration = 0.2f;
@@ -126,6 +126,17 @@
         }
 
         /// <summary>
+        ///     Sets a given toggle to the specified state with null checking.
+        /// </summary>
+        private static void SetToggle(Toggle toggle, bool state)
+        {
+            if (toggle != null)
+            {
+                toggle.isOn = state;
+            }
+        }
+
+        /// <summary>
         ///     Called when the application launcher button is hovered over.
         /// </summary>
         private void ButtonHover()
@@ -166,13 +177,5 @@
         {
             FadeTo(0.0f, m_FastFadeDuration, Destroy);
         }
-
-        private void SetToggle(Toggle toggle, bool state)
-        {
-            if (toggle != null)
-            {
-                toggle.isOn = state;
-            }
-        }
     }
 }