Skip to content

Commit

Permalink
don't save invalid wkb
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Feb 9, 2016
1 parent 026a5c7 commit 4a8b49b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/core/geometry/qgsgeometry.cpp
Expand Up @@ -245,8 +245,17 @@ void QgsGeometry::fromWkb( unsigned char *wkb, int length )
removeWkbGeos();
}
d->geometry = QgsGeometryFactory::geomFromWkb( QgsConstWkbPtr( wkb, length ) );
d->mWkb = wkb;
d->mWkbSize = length;
if ( d->geometry )
{
d->mWkb = wkb;
d->mWkbSize = length;
}
else
{
delete [] wkb;
d->mWkb = nullptr;
d->mWkbSize = 0;
}
}

const unsigned char *QgsGeometry::asWkb() const
Expand Down

0 comments on commit 4a8b49b

Please sign in to comment.