Changeset 14241


Ignore:
Timestamp:
01/14/13 08:00:21 (12 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixed crash

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Container/Observations.cpp

    r14240 r14241  
    129129        Observation *observation  = NULL;
    130130
     131        /*If radius is not provided or is 0, return all observations*/
     132        if(radius==0) radius=this->quadtree->root->length;
     133
    131134        /*First, find closest point in Quadtree (fast but might not be the true closest obs)*/
    132135        this->quadtree->ClosestObs(&index,x_interp,y_interp);
    133         _assert_(index>=0);
    134         observation=dynamic_cast<Observation*>(this->GetObjectByOffset(index));
    135         hmin = sqrt((observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp));
     136        if(index>=0){
     137                observation=dynamic_cast<Observation*>(this->GetObjectByOffset(index));
     138                hmin = sqrt((observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp));
     139                if(hmin<radius) radius=hmin;
     140        }
    136141
    137142        /*Compute radius square*/
    138         if(radius==0 || hmin<radius){
    139                 radius=hmin;
    140         }
    141143        radius2 = radius*radius;
    142144
Note: See TracChangeset for help on using the changeset viewer.