Skip to content

Commit

Permalink
FlatGeobuf: add null check for readMultiPolygon (#2461) (fixes #2459)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornharrtell authored and rouault committed May 1, 2020
1 parent 1c0b0fa commit b4e4998
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gdal/ogr/ogrsf_frmts/flatgeobuf/geometryreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ OGRMultiPolygon *GeometryReader::readMultiPolygon()
auto mp = std::unique_ptr<OGRMultiPolygon>(new OGRMultiPolygon());
for (uoffset_t i = 0; i < parts->size(); i++) {
GeometryReader reader { parts->Get(i), GeometryType::Polygon, m_hasZ, m_hasM };
auto p = std::unique_ptr<OGRPolygon>(reader.read()->toPolygon());
if (p == nullptr)
auto g = std::unique_ptr<OGRGeometry>(reader.read());
if (g == nullptr)
return nullptr;
mp->addGeometryDirectly(p.release());
mp->addGeometryDirectly(g.release()->toPolygon());
}
return mp.release();
}
Expand Down

0 comments on commit b4e4998

Please sign in to comment.