[Orxonox-commit 3981] r8655 - code/branches/presentation/src/libraries/core

landauf at orxonox.net landauf at orxonox.net
Sun May 29 10:31:16 CEST 2011


Author: landauf
Date: 2011-05-29 10:31:15 +0200 (Sun, 29 May 2011)
New Revision: 8655

Modified:
   code/branches/presentation/src/libraries/core/BaseObject.cc
Log:
fixed crashing assertion in case a template linked to a non-existing template

Modified: code/branches/presentation/src/libraries/core/BaseObject.cc
===================================================================
--- code/branches/presentation/src/libraries/core/BaseObject.cc	2011-05-29 07:58:34 UTC (rev 8654)
+++ code/branches/presentation/src/libraries/core/BaseObject.cc	2011-05-29 08:31:15 UTC (rev 8655)
@@ -194,14 +194,19 @@
     */
     void BaseObject::addTemplate(Template* temp)
     {
-        this->templates_.insert(temp);
-        if( temp->isLink() )
+        // network
+        if (temp->isLink())
         {
-          this->networkTemplateNames_.insert(temp->getLink());
-          assert( !Template::getTemplate(temp->getLink())->isLink() );
+            this->networkTemplateNames_.insert(temp->getLink());
+            
+            Template* link;
+            assert(!(link = Template::getTemplate(temp->getLink())) || !link->isLink());
         }
         else
-          this->networkTemplateNames_.insert(temp->getName());
+            this->networkTemplateNames_.insert(temp->getName());
+
+        // add template
+        this->templates_.insert(temp);
         temp->applyOn(this);
     }
 




More information about the Orxonox-commit mailing list