]> git.mxchange.org Git - simgear.git/commitdiff
Don't crash when destroying a SGBinding object if the property node it
authorandy <andy>
Wed, 14 Feb 2007 23:14:00 +0000 (23:14 +0000)
committerandy <andy>
Wed, 14 Feb 2007 23:14:00 +0000 (23:14 +0000)
was loaded from lacks a parent.  Patch from ndim on IRC

simgear/structure/SGBinding.cxx

index acd91814c50ebec4cefcbf64b966f2bb51ddd194..0c3f7feb4eb384090366c135b8028594c9c854db 100644 (file)
@@ -27,7 +27,8 @@ SGBinding::SGBinding(const SGPropertyNode* node, SGPropertyNode* root)
 
 SGBinding::~SGBinding()
 {
-  _arg->getParent()->removeChild(_arg->getName(), _arg->getIndex(), false);
+  if(_arg && _arg->getParent())
+    _arg->getParent()->removeChild(_arg->getName(), _arg->getIndex(), false);
 }
 
 void