From 968220f08ee988b5a805a70e26f6400ad30fd998 Mon Sep 17 00:00:00 2001 From: Ulrich Egger Date: Fri, 17 Mar 2023 13:50:33 +0100 Subject: [PATCH] Bugfix for the case that the byte array contains double.NaN values within the envelope coordinates --- src/NetTopologySuite.IO.SpatiaLite/GaiaGeoReader.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/NetTopologySuite.IO.SpatiaLite/GaiaGeoReader.cs b/src/NetTopologySuite.IO.SpatiaLite/GaiaGeoReader.cs index 6d0564d..f576652 100644 --- a/src/NetTopologySuite.IO.SpatiaLite/GaiaGeoReader.cs +++ b/src/NetTopologySuite.IO.SpatiaLite/GaiaGeoReader.cs @@ -145,10 +145,15 @@ public Geometry Read(byte[] blob) // break; //}; offset = 6; - var env = new Envelope(gaiaImport.GetDouble(blob, ref offset), - gaiaImport.GetDouble(blob, ref offset), - gaiaImport.GetDouble(blob, ref offset), - gaiaImport.GetDouble(blob, ref offset)); + + //the next four values are the envelope, but it is not required here + //consider that if the values contain double.NaN + //the NetTopologySuite.Geometries.Envelope constructor might fail + + for (int i = 0; i != 4; ++i) + { + gaiaImport.GetDouble(blob, ref offset); + } offset = 39; var type = (GaiaGeoGeometry)gaiaImport.GetInt32(blob, ref offset);