diff --git a/src/FDM/flight.cxx b/src/FDM/flight.cxx index 6b6424089..5676e688b 100644 --- a/src/FDM/flight.cxx +++ b/src/FDM/flight.cxx @@ -410,6 +410,10 @@ FGInterface::bind () void FGInterface::unbind () { + if (!bound) { + return; + } + bound = false; fgUntie("/position/latitude-deg"); diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index 896f713ae..4d944bfc3 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -827,10 +827,21 @@ fgSetWritable (const char * name, bool state) } void -fgUntie (const char * name) +fgUntie(const char * name) { - if (!globals->get_props()->untie(name)) + SGPropertyNode* node = globals->get_props()->getNode(name); + if (!node) { + SG_LOG(SG_GENERAL, SG_WARN, "fgUntie: unknown property " << name); + return; + } + + if (!node->isTied()) { + return; + } + + if (!node->untie()) { SG_LOG(SG_GENERAL, SG_WARN, "Failed to untie property " << name); + } }