From 5a60584743c583c15403f82f7fb7c2654364d942 Mon Sep 17 00:00:00 2001 From: Jonathan Bayer Date: Sun, 9 Apr 2023 13:25:47 -0400 Subject: [PATCH] Thanks to forum user @ozraven for this: Fixed a null ref which occurred when clicking in a debug window --- ChangeLog.txt | 4 ++++ EditorExtensionsRedux.version | 4 ++-- EditorExtensionsRedux/AssemblyVersion.cs | 4 ++-- EditorExtensionsRedux/EditorExtensionsRedux.cs | 2 +- EditorExtensionsRedux/FineAdjustWindow.cs | 12 ++++++------ EditorExtensionsRedux/StockSettings.cs | 2 +- EditorExtensionsRedux/Utility.cs | 2 +- .../EditorExtensionsRedux.version | 7 ++++++- 8 files changed, 23 insertions(+), 14 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f14e64a..1c27380 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,9 @@ ChangeLog +3.4.3.6 + Thanks to forum user @ozraven for this: + Fixed a null ref which occurred when clicking in a debug window + 3.4.3.5 Added AssemblyFileVersion Updated version file for 1.12 diff --git a/EditorExtensionsRedux.version b/EditorExtensionsRedux.version index d41c14a..b22c071 100644 --- a/EditorExtensionsRedux.version +++ b/EditorExtensionsRedux.version @@ -6,12 +6,12 @@ "MAJOR": 3, "MINOR": 4, "PATCH": 3, - "BUILD": 5 + "BUILD": 6 }, "KSP_VERSION": { "MAJOR": 1, "MINOR": 12, - "PATCH": 0 + "PATCH": 5 }, "KSP_VERSION_MIN": { "MAJOR": 1, diff --git a/EditorExtensionsRedux/AssemblyVersion.cs b/EditorExtensionsRedux/AssemblyVersion.cs index 67d359d..b287e50 100644 --- a/EditorExtensionsRedux/AssemblyVersion.cs +++ b/EditorExtensionsRedux/AssemblyVersion.cs @@ -10,5 +10,5 @@ using System.Reflection; - [assembly: AssemblyVersion("3.4.3.4")] - [assembly: AssemblyFileVersion("3.4.3.4")] \ No newline at end of file + [assembly: AssemblyVersion("3.4.3.6")] + [assembly: AssemblyFileVersion("3.4.3.6")] \ No newline at end of file diff --git a/EditorExtensionsRedux/EditorExtensionsRedux.cs b/EditorExtensionsRedux/EditorExtensionsRedux.cs index 4566c37..16a87f9 100644 --- a/EditorExtensionsRedux/EditorExtensionsRedux.cs +++ b/EditorExtensionsRedux/EditorExtensionsRedux.cs @@ -1479,7 +1479,7 @@ public class Config //var gizmosRotate = HighLogic.FindObjectsOfType (); // if (gizmoRotateHandle == null) // gizmoRotateHandle = HighLogic.FindObjectOfType (); - float rotation = FineAdjustWindow.Instance.rotation; + float rotation = FineAdjustWindow.Instance.rotationZZ; if (Input.GetKey(cfg.KeyMap.Down)) { diff --git a/EditorExtensionsRedux/FineAdjustWindow.cs b/EditorExtensionsRedux/FineAdjustWindow.cs index 0bc78bf..c077c1c 100644 --- a/EditorExtensionsRedux/FineAdjustWindow.cs +++ b/EditorExtensionsRedux/FineAdjustWindow.cs @@ -82,7 +82,7 @@ enum AdjustmentType AdjustmentType adjType = AdjustmentType.translation; string adjTypeStr = "Translation"; public float offset = 0.01f; - public float rotation = 1.0f; + public float rotationZZ = 1.0f; public int offsetDeltaIndex = 2; public int rotationdeltaIndex = 0; @@ -205,9 +205,9 @@ void WindowContent (int windowID) if (GUILayout.Button ("-", GUILayout.Width (20))) { switch (adjType) { case AdjustmentType.rotation: - rotation -= getDelta (rotationdeltaIndex); - if (rotation <= 0.0f) - rotation = getDelta (rotationdeltaIndex); + rotationZZ -= getDelta (rotationdeltaIndex); + if (rotationZZ <= 0.0f) + rotationZZ = getDelta (rotationdeltaIndex); break; case AdjustmentType.translation: @@ -220,7 +220,7 @@ void WindowContent (int windowID) } switch (adjType) { case AdjustmentType.rotation: - GUILayout.Label (rotation.ToString (), "TextField"); + GUILayout.Label (rotationZZ.ToString (), "TextField"); break; case AdjustmentType.translation: GUILayout.Label (offset.ToString (), "TextField"); @@ -230,7 +230,7 @@ void WindowContent (int windowID) if (GUILayout.Button ("+", GUILayout.Width (20))) { switch (adjType) { case AdjustmentType.rotation: - rotation += getDelta (rotationdeltaIndex); + rotationZZ += getDelta (rotationdeltaIndex); break; case AdjustmentType.translation: offset += getDelta (offsetDeltaIndex); diff --git a/EditorExtensionsRedux/StockSettings.cs b/EditorExtensionsRedux/StockSettings.cs index 1ab5b15..4126268 100644 --- a/EditorExtensionsRedux/StockSettings.cs +++ b/EditorExtensionsRedux/StockSettings.cs @@ -37,7 +37,7 @@ public override bool Enabled(MemberInfo member, GameParameters parameters) return true; } - bool unread = false; + //bool unread = false; public override bool Interactible(MemberInfo member, GameParameters parameters) { diff --git a/EditorExtensionsRedux/Utility.cs b/EditorExtensionsRedux/Utility.cs index f2de81c..43c0ef1 100644 --- a/EditorExtensionsRedux/Utility.cs +++ b/EditorExtensionsRedux/Utility.cs @@ -14,7 +14,7 @@ public static Part GetPartUnderCursor() EditorLogic ed = EditorLogic.fetch; if (ed != null && Physics.Raycast(ray, out hit)) { - return ed.ship.Parts.Find(p => p.gameObject == hit.transform.gameObject); + return ed.ship.Parts.Find(p => p != null && p.gameObject == hit.transform.gameObject); } return null; } diff --git a/GameData/EditorExtensionsRedux/EditorExtensionsRedux.version b/GameData/EditorExtensionsRedux/EditorExtensionsRedux.version index 7eee783..b22c071 100644 --- a/GameData/EditorExtensionsRedux/EditorExtensionsRedux.version +++ b/GameData/EditorExtensionsRedux/EditorExtensionsRedux.version @@ -6,7 +6,12 @@ "MAJOR": 3, "MINOR": 4, "PATCH": 3, - "BUILD": 4 + "BUILD": 6 + }, + "KSP_VERSION": { + "MAJOR": 1, + "MINOR": 12, + "PATCH": 5 }, "KSP_VERSION_MIN": { "MAJOR": 1,