Skip to content

Commit e4b2765

Browse files
szekerestgithub-actions[bot]
authored andcommitted
Handle null shapes in msShapefileWhichShapes (#6521)
1 parent e0b8f4e commit e4b2765

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mapshape.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -1877,8 +1877,12 @@ int msShapefileWhichShapes(shapefileObj *shpfile, rectObj rect, int debug)
18771877
}
18781878

18791879
for(i=0; i<shpfile->numshapes; i++) {
1880-
if(msSHPReadBounds(shpfile->hSHP, i, &shaperect) != MS_SUCCESS)
1880+
if(msSHPReadBounds(shpfile->hSHP, i, &shaperect) != MS_SUCCESS) {
1881+
if (msSHXReadSize(shpfile->hSHP, i) == 4) { /* handle NULL shape */
1882+
continue;
1883+
}
18811884
return(MS_FAILURE);
1885+
}
18821886

18831887
if(msRectOverlap(&shaperect, &rect) == MS_TRUE) msSetBit(shpfile->status, i, 1);
18841888
}

0 commit comments

Comments
 (0)