Skip to content

Commit

Permalink
fix: potential error source in get_extent
Browse files Browse the repository at this point in the history
  • Loading branch information
LandscapeLab Office committed Dec 20, 2023
1 parent ab66d58 commit e0b0f5f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/vector-extractor/NativeLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,14 @@ ExtentData NativeLayer::get_extent() {
OGREnvelope *envelope = new OGREnvelope();
OGRErr error = layer->GetExtent(envelope);

ExtentData extent(envelope->MinX, envelope->MaxX, envelope->MinY, envelope->MaxY);
if (error == OGRERR_NONE) {
ExtentData extent(envelope->MinX, envelope->MaxX, envelope->MinY, envelope->MaxY);

delete envelope;
return extent;
delete envelope;
return extent;
} else {
return ExtentData();
}
}

std::list<std::shared_ptr<Feature> > NativeLayer::get_feature_by_id(int id) {
Expand Down

0 comments on commit e0b0f5f

Please sign in to comment.