diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index b372c94f38a8006db9b83ab633446e509b4e009e..ab16e36b7c0e1100bb771909c8905031dc030532 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -243,9 +243,11 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), UAS::~UAS() { stopHil(); - // wait for the simulator to exit - simulation->wait(); - simulation->deleteLater(); + if (simulation) { + // wait for the simulator to exit + simulation->wait(); + simulation->deleteLater(); + } writeSettings(); }