Skip to content

Commit

Permalink
#602 crashed when save to csv with invalid row
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Feb 15, 2017
1 parent 84a44dc commit 7994eb9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ShapeOperations/OGRLayerProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,17 @@ OGRLayerProxy::AddFeatures(vector<OGRGeometry*>& geometries,
}
}
export_progress = export_size / 2;

for (size_t i=0; i<data.size(); i++) {
if (stop_exporting) return;
if ((i+1)%2==0)

int n_data = data.size();
for (int i=0; i<n_data; i++) {
if (stop_exporting)
return;
if ((i+1)%2==0) {
export_progress++;
}
if( layer->CreateFeature( data[i] ) != OGRERR_NONE ) {
wxString msg = wxString::Format(" Failed to create feature (%d/%d).", i + 1, data.size());
error_message << msg;
wxString msg = wxString::Format(" Failed to create feature (%d/%d).", i + 1, n_data);
error_message << msg << CPLGetLastErrorMsg();
export_progress = -1;
return;
}
Expand Down

0 comments on commit 7994eb9

Please sign in to comment.