Skip to content
Permalink
Browse files

[mssql] Fix debug spam when features have null geometry

  • Loading branch information
nyalldawson committed May 29, 2017
1 parent ce3737e commit 67d778f389076f0432b0b3a3131abc36d0f67d59
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/providers/mssql/qgsmssqlfeatureiterator.cpp
@@ -328,12 +328,19 @@ bool QgsMssqlFeatureIterator::fetchFeature( QgsFeature& feature )
if ( mSource->isSpatial() )
{
QByteArray ar = mQuery->record().value( mSource->mGeometryColName ).toByteArray();
unsigned char* wkb = mParser.ParseSqlGeometry(( unsigned char* )ar.data(), ar.size() );
if ( wkb )
if ( !ar.isEmpty() )
{
QgsGeometry *g = new QgsGeometry();
g->fromWkb( wkb, mParser.GetWkbLen() );
feature.setGeometry( g );
unsigned char* wkb = mParser.ParseSqlGeometry(( unsigned char* )ar.data(), ar.size() );
if ( wkb )
{
QgsGeometry *g = new QgsGeometry();
g->fromWkb( wkb, mParser.GetWkbLen() );
feature.setGeometry( g );
}
else
{
feature.setGeometry( nullptr );
}
}
else
{

0 comments on commit 67d778f

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