Changeset 14705

Show
Ignore:
Timestamp:
06/14/08 14:35:08 (6 months ago)
Author:
rouault
Message:

gdal_grid : fix crash on features with NULL geometry or when no point geometry is found on a layer (#2424)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/apps/gdal_grid.cpp

    r14513 r14705  
    379379 
    380380        // FIXME: handle collections 
    381         if ( OGR_G_GetGeometryType( hGeom ) == wkbPoint 
    382              || OGR_G_GetGeometryType( hGeom ) == wkbPoint25D ) 
     381        if ( hGeom != NULL && 
     382             (OGR_G_GetGeometryType( hGeom ) == wkbPoint 
     383              || OGR_G_GetGeometryType( hGeom ) == wkbPoint25D) ) 
    383384        { 
    384385            adfX.push_back( OGR_G_GetX( hGeom, 0 ) ); 
     
    392393         
    393394        OGR_F_Destroy( hFeat ); 
     395    } 
     396 
     397    if (adfX.size() == 0) 
     398    { 
     399        printf( "No point geometry found on layer %s, skipping.\n", 
     400                OGR_FD_GetName( OGR_L_GetLayerDefn( hSrcLayer ) ) ); 
     401       return; 
    394402    } 
    395403