Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3880 in orxonox.OLD


Ignore:
Timestamp:
Apr 18, 2005, 7:29:43 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: trackManager should not end up in a seg-fault anymore when findByID returns NULL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/track_manager.cc

    r3872 r3880  
    762762{
    763763  TrackElement* tmpTrackElem;
     764  TrackElement* tmpJoinElem;
    764765  for (int i = 0; i < count; i++)
    765766    if (!this->firstTrackElem->findByID(trackIDs[i]))
     
    793794  for (int i = 0; i < count; i++)
    794795    {
    795       TrackElement* tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]);
    796       if (tmpJoinElem->childCount == 0
    797           && tmpJoinElem->endTime > tmpLatestTime)
    798         tmpLatestTime = tmpJoinElem->endTime;
     796      if(tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]))
     797        {
     798          if (tmpJoinElem->childCount == 0
     799              && tmpJoinElem->endTime > tmpLatestTime)
     800            tmpLatestTime = tmpJoinElem->endTime;
     801        }
    799802    }
    800803  // time the main Join.
     
    804807  for (int i = 1; i < count; i++)
    805808    {
    806       TrackElement* tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]);
    807       if (tmpJoinElem->childCount > 0)
    808         printf("!!This Curve has children, and as such will not be joined!!\n You can try joining other childless TrackElements to this one!");
    809       else
    810         {
    811           this->addPoint(tmpc2Point, tmpJoinElem);
    812           this->addPoint(tmpTangentPoint, tmpJoinElem);
    813           this->addPoint(tmpEndPoint, tmpJoinElem);
    814           // time all other Joins
    815           tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime;
    816          
    817           //Copying Joint-Info
    818           tmpJoinElem->children = firstJoint->children;
    819           tmpJoinElem->childCount = firstJoint->childCount;
    820           tmpJoinElem->isSavePoint = firstJoint->isSavePoint;
    821           tmpJoinElem->isFork = firstJoint->isFork;
    822 
    823           tmpJoinElem->isJoined = true;
     809      if( tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]))
     810        {
     811          if (tmpJoinElem->childCount > 0)
     812            printf("!!This Curve has children, and as such will not be joined!!\n You can try joining other childless TrackElements to this one!");
     813          else
     814            {
     815              this->addPoint(tmpc2Point, tmpJoinElem);
     816              this->addPoint(tmpTangentPoint, tmpJoinElem);
     817              this->addPoint(tmpEndPoint, tmpJoinElem);
     818              // time all other Joins
     819              tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime;
     820             
     821              //Copying Joint-Info
     822              tmpJoinElem->children = firstJoint->children;
     823              tmpJoinElem->childCount = firstJoint->childCount;
     824              tmpJoinElem->isSavePoint = firstJoint->isSavePoint;
     825              tmpJoinElem->isFork = firstJoint->isFork;
     826             
     827              tmpJoinElem->isJoined = true;
     828            }
    824829        }
    825830    }
Note: See TracChangeset for help on using the changeset viewer.