Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Npgsql.NetTopologySuite/NpgsqlPostGisWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ private static Ordinates CheckOrdinates(IGeometry geometry)
return CheckOrdinates(((ILineString)geometry).CoordinateSequence);
if (geometry is IPolygon)
return CheckOrdinates((((IPolygon)geometry).ExteriorRing).CoordinateSequence);
if (geometry is IGeometryCollection)
return CheckOrdinates(geometry.GetGeometryN(0));
if (geometry is IGeometryCollection collection)
return collection.Count == 0 ? Ordinates.None : CheckOrdinates(collection.GetGeometryN(0));

Assert.ShouldNeverReachHere();
return Ordinates.None;
Expand Down
6 changes: 6 additions & 0 deletions test/Npgsql.PluginTests/NetTopologySuiteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ public static IEnumerable TestCases {
"st_multi(st_makepolygon(st_makeline(ARRAY[st_makepoint(1,1),st_makepoint(2,2),st_makepoint(3,3),st_makepoint(1,1)])))"
);

yield return new TestCaseData(
Ordinates.None,
GeometryCollection.Empty,
"st_geomfromtext('GEOMETRYCOLLECTION EMPTY')"
);

yield return new TestCaseData(
Ordinates.None,
new GeometryCollection(new IGeometry[]
Expand Down