Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved detection of broken mods #4137

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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