From d7155bde38cd1e45b0cdbe48e0d2189f4f554eed Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 17 Dec 2020 10:29:47 +0000 Subject: [PATCH] Attempting to fix crash with the Wright-flyer Some users crash in the UIUC code during init; this change is to try to understand why. Sentry-Id: FLIGHTGEAR-SA --- src/FDM/LaRCsim/LaRCsim.cxx | 2 +- src/FDM/UIUCModel/uiuc_wrapper.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/FDM/LaRCsim/LaRCsim.cxx b/src/FDM/LaRCsim/LaRCsim.cxx index 232d6f97b..7ee0d3c6a 100644 --- a/src/FDM/LaRCsim/LaRCsim.cxx +++ b/src/FDM/LaRCsim/LaRCsim.cxx @@ -761,7 +761,7 @@ bool FGLaRCsim::copy_from_LaRCsim() { // cout << "climb rate = " << -V_down * 60 << endl; #ifdef ENABLE_UIUC_MODEL - if ( !strcmp(aero->getStringValue(), "uiuc") ) { + if (!strcmp(aero->getStringValue(), "uiuc") && aircraft_) { if (pilot_elev_no) { globals->get_controls()->set_elevator(Long_control); globals->get_controls()->set_elevator_trim(Long_trim); diff --git a/src/FDM/UIUCModel/uiuc_wrapper.cpp b/src/FDM/UIUCModel/uiuc_wrapper.cpp index 297c0e6b2..e55de1577 100644 --- a/src/FDM/UIUCModel/uiuc_wrapper.cpp +++ b/src/FDM/UIUCModel/uiuc_wrapper.cpp @@ -85,9 +85,10 @@ #include #include +#include
+#include
#include #include -#include
#include "uiuc_aircraft.h" #include "uiuc_coefficients.h" @@ -159,8 +160,12 @@ void uiuc_initial_init () void uiuc_defaults_inits () { - if (aircraft_ == 0) - aircraft_ = new AIRCRAFT; + if (aircraft_ == 0) { + // becuase we're getting crashes about aircraft_ being null, add + // an explicit breadcrumb at this point + flightgear::addSentryBreadcrumb("UIUC aircraf created", "info"); + aircraft_ = new AIRCRAFT; + } // set defaults and initialize (called once from uiuc_init_2_wrapper)