Skip to content

Commit

Permalink
Merge pull request #4137 from pleroy/StupidMods
Browse files Browse the repository at this point in the history
Improved detection of broken mods
  • Loading branch information
pleroy authored Nov 21, 2024
2 parents 4e766e6 + 878b5b9 commit e384167
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions ksp_plugin_adapter/ksp_plugin_adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -733,17 +733,29 @@ public static void LoadTextureOrDie(out UnityEngine.Texture texture,
public static double RadiusAt(CelestialBody centre,
double latitude,
double longitude) {
double altitude = centre.TerrainAltitude(
latitude,
longitude,
allowNegative: !centre.ocean);
double altitude = 0;
try {
altitude = centre.TerrainAltitude(latitude,
longitude,
allowNegative: !centre.ocean);
} catch (Exception e) {
Log.Fatal("Terrain system raised exception " + e.ToString() +
" when computing altitude at latitude " +
latitude +
", longitude " +
longitude +
" for celestial " +
centre.name +
"; you are probably using a mod incompatible with Principia");
}
if (double.IsNaN(altitude)) {
Log.Fatal("Terrain system returned NaN for altitude at latitude " +
latitude +
", longitude " +
longitude +
" for celestial " +
centre.name);
centre.name +
"; you are probably using a mod incompatible with Principia");
}
if (double.IsNaN(centre.Radius)) {
Log.Fatal("Radius is NaN for celestial " + centre.name);
Expand Down

0 comments on commit e384167

Please sign in to comment.