Skip to content
Permalink
Browse files

Fix null dereference errors

  • Loading branch information
nyalldawson committed Feb 16, 2015
1 parent e6f91ca commit c9c15afaa27dbd8e68060d467a05a81d3fba4be7
Showing with 13 additions and 21 deletions.
  1. +2 −13 src/core/pal/util.cpp
  2. +8 −5 src/core/qgsofflineediting.cpp
  3. +2 −2 src/providers/ogr/qgsogrdataitems.cpp
  4. +1 −1 src/server/qgswmsserver.cpp
@@ -183,25 +183,16 @@ namespace pal
}
}




//inline bool ptrGeomEq (const geos::geom::Geometry *l, const geos::geom::Geometry *r){
inline bool ptrGeomEq( const GEOSGeometry *l, const GEOSGeometry *r )
{
return l == r;
}

//LinkedList<const geos::geom::Geometry*> * unmulti (geos::geom::Geometry *the_geom){
LinkedList<const GEOSGeometry*> * unmulti( const GEOSGeometry *the_geom )
{

//LinkedList<const geos::geom::Geometry*> *queue = new LinkedList<const geos::geom::Geometry*>(ptrGeomEq);
//LinkedList<const geos::geom::Geometry*> *final_queue = new LinkedList<const geos::geom::Geometry*>(ptrGeomEq);
LinkedList<const GEOSGeometry*> *queue = new LinkedList<const GEOSGeometry*> ( ptrGeomEq );
LinkedList<const GEOSGeometry*> *final_queue = new LinkedList<const GEOSGeometry*> ( ptrGeomEq );

//const geos::geom::Geometry *geom;
const GEOSGeometry *geom;

queue->push_back( the_geom );
@@ -214,9 +205,6 @@ namespace pal
GEOSContextHandle_t geosctxt = geosContext();
switch ( GEOSGeomTypeId_r( geosctxt, geom ) )
{
//case geos::geom::GEOS_MULTIPOINT:
//case geos::geom::GEOS_MULTILINESTRING:
//case geos::geom::GEOS_MULTIPOLYGON:
case GEOS_MULTIPOINT:
case GEOS_MULTILINESTRING:
case GEOS_MULTIPOLYGON:
@@ -233,7 +221,8 @@ namespace pal
break;
default:
delete final_queue;
final_queue = NULL;
delete queue;
return NULL;
}
}
delete queue;
@@ -580,11 +580,14 @@ QgsVectorLayer* QgsOfflineEditing::copyVectorLayer( QgsVectorLayer* layer, sqlit
int index = parentTreeGroup->children().indexOf( layerTreeLayer );
// Move the new layer from the root group to the new group
QgsLayerTreeLayer* newLayerTreeLayer = layerTreeRoot->findLayer( newLayer->id() );
QgsLayerTreeNode* newLayerTreeLayerClone = newLayerTreeLayer->clone();
QgsLayerTreeGroup* grp = qobject_cast<QgsLayerTreeGroup*>( newLayerTreeLayer->parent() );
parentTreeGroup->insertChildNode( index, newLayerTreeLayerClone );
if ( grp )
grp->removeChildNode( newLayerTreeLayer );
if ( newLayerTreeLayer )
{
QgsLayerTreeNode* newLayerTreeLayerClone = newLayerTreeLayer->clone();
QgsLayerTreeGroup* grp = qobject_cast<QgsLayerTreeGroup*>( newLayerTreeLayer->parent() );
parentTreeGroup->insertChildNode( index, newLayerTreeLayerClone );
if ( grp )
grp->removeChildNode( newLayerTreeLayer );
}
}
}

@@ -252,8 +252,8 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
bool scanExtSetting = false;
if (( settings.value( "/qgis/scanItemsInBrowser2",
"extension" ).toString() == "extension" ) ||
( settings.value( "/qgis/scanItemsFastScanUris",
QStringList() ).toStringList().contains( parentItem->path() ) ) ||
( parentItem && settings.value( "/qgis/scanItemsFastScanUris",
QStringList() ).toStringList().contains( parentItem->path() ) ) ||
(( is_vsizip || is_vsitar ) && parentItem && parentItem->parent() &&
settings.value( "/qgis/scanItemsFastScanUris",
QStringList() ).toStringList().contains( parentItem->parent()->path() ) ) )
@@ -2989,7 +2989,7 @@ QDomElement QgsWMSServer::createFeatureGML(
typeNameElement.appendChild( bbElem );
}

if ( withGeom )
if ( withGeom && geom )
{
//add geometry column (as gml)

0 comments on commit c9c15af

Please sign in to comment.
You can’t perform that action at this time.