Skip to content

Commit

Permalink
Merge pull request #4123 from pleroy/4119
Browse files Browse the repository at this point in the history
Make sure that a deserialized flight plan exists before accessing the flight plan
  • Loading branch information
pleroy authored Oct 26, 2024
2 parents 6f595e3 + fa90b21 commit 1f783a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ksp_plugin/interface_planetarium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ void __cdecl principia__PlanetariumPlotCelestialFutureTrajectory(
Instant const prediction_final_time = vessel.prediction()->t_max();
Instant const final_time =
vessel.has_flight_plan()
? std::max(vessel.flight_plan().actual_final_time(),
? std::max(GetFlightPlan(*plugin, vessel_guid).actual_final_time(),
prediction_final_time)
: prediction_final_time;
auto const& celestial_trajectory =
Expand Down
1 change: 1 addition & 0 deletions ksp_plugin/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,7 @@ void Plugin::ExtendPredictionForFlightPlan(GUID const& vessel_guid) const {
// no guarantee that it will be long enough. Presumably the user will keep
// increasing the flight plan length and get what they want, ultimately.
if (renderer_->HasTargetVessel() && vessel.has_flight_plan()) {
vessel.ReadFlightPlanFromMessage();
auto& target_vessel = renderer_->GetTargetVessel();
if (target_vessel.prediction()->back().time <
vessel.flight_plan().actual_final_time()) {
Expand Down

0 comments on commit 1f783a7

Please sign in to comment.