Skip to content

Commit 07d9631

Browse files
committed
Recompile for KSP 1.4.0; Fixed NRE when importing custom waypoints.
1 parent 259c61d commit 07d9631

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Waypoint Manager 2.7.1
2+
- Recompile for KSP 1.4.0
3+
- Fixed NRE when importing custom waypoints before stock waypoint manager is loaded (thanks linuxgurugamer).
4+
15
Waypoint Manager 2.7.0
26
- Recompile for KSP 1.3.0.
37
- Don't allow stock toolbar icon to be disabled if Blizzy's toolbar isn't installed.
0 Bytes
Binary file not shown.

source/WaypointManager/CustomWaypoints.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public static void Import()
129129
ConfigNode configNode = ConfigNode.Load(CustomWaypointsFileName);
130130
if (configNode == null)
131131
{
132-
ScreenMessages.PostScreenMessage(string.Format("Couldn't load customer waypoint file {0}!", CustomWaypointsFileName),
132+
ScreenMessages.PostScreenMessage(string.Format("Couldn't load custom waypoint file {0}!", CustomWaypointsFileName),
133133
6.0f, ScreenMessageStyle.UPPER_CENTER);
134134
return;
135135
}
@@ -145,15 +145,18 @@ public static void Import()
145145
double longitude = double.Parse(child.GetValue("longitude"));
146146
double altitude = double.Parse(child.GetValue("altitude"));
147147

148-
foreach (Waypoint wp in FinePrint.WaypointManager.Instance().Waypoints)
148+
if (FinePrint.WaypointManager.Instance() != null)
149149
{
150-
if (wp.celestialName == celestialName &&
151-
Math.Abs(wp.latitude - latitude) < 0.00001 &&
152-
Math.Abs(wp.longitude - longitude) < 0.00001 &&
153-
Math.Abs(wp.altitude - altitude) < 0.1)
150+
foreach (Waypoint wp in FinePrint.WaypointManager.Instance().Waypoints)
154151
{
155-
isDuplicate = true;
156-
break;
152+
if (wp.celestialName == celestialName &&
153+
Math.Abs(wp.latitude - latitude) < 0.00001 &&
154+
Math.Abs(wp.longitude - longitude) < 0.00001 &&
155+
Math.Abs(wp.altitude - altitude) < 0.1)
156+
{
157+
isDuplicate = true;
158+
break;
159+
}
157160
}
158161
}
159162

source/WaypointManager/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
3535
[assembly: AssemblyVersion("1.0")]
36-
[assembly: AssemblyFileVersion("2.6.2")]
37-
[assembly: AssemblyInformationalVersion("2.6.2")]
36+
[assembly: AssemblyFileVersion("2.7.1")]
37+
[assembly: AssemblyInformationalVersion("2.7.1")]
3838
[assembly: KSPAssembly("WaypointManager", 1, 0)]

0 commit comments

Comments
 (0)