Skip to content

Commit e384167

Browse files
authored
Merge pull request #4137 from pleroy/StupidMods
Improved detection of broken mods
2 parents 4e766e6 + 878b5b9 commit e384167

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

ksp_plugin_adapter/ksp_plugin_adapter.cs

+17-5
Original file line numberDiff line numberDiff line change
@@ -733,17 +733,29 @@ public static void LoadTextureOrDie(out UnityEngine.Texture texture,
733733
public static double RadiusAt(CelestialBody centre,
734734
double latitude,
735735
double longitude) {
736-
double altitude = centre.TerrainAltitude(
737-
latitude,
738-
longitude,
739-
allowNegative: !centre.ocean);
736+
double altitude = 0;
737+
try {
738+
altitude = centre.TerrainAltitude(latitude,
739+
longitude,
740+
allowNegative: !centre.ocean);
741+
} catch (Exception e) {
742+
Log.Fatal("Terrain system raised exception " + e.ToString() +
743+
" when computing altitude at latitude " +
744+
latitude +
745+
", longitude " +
746+
longitude +
747+
" for celestial " +
748+
centre.name +
749+
"; you are probably using a mod incompatible with Principia");
750+
}
740751
if (double.IsNaN(altitude)) {
741752
Log.Fatal("Terrain system returned NaN for altitude at latitude " +
742753
latitude +
743754
", longitude " +
744755
longitude +
745756
" for celestial " +
746-
centre.name);
757+
centre.name +
758+
"; you are probably using a mod incompatible with Principia");
747759
}
748760
if (double.IsNaN(centre.Radius)) {
749761
Log.Fatal("Radius is NaN for celestial " + centre.name);

0 commit comments

Comments
 (0)