diff --git a/src/reader.rs b/src/reader.rs index 2f37179..02d2b88 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -1134,18 +1134,13 @@ where _ => {} } } - if coords.is_empty() { - Err(Error::InvalidGeometry( - "Geometry must contain coordinates element".to_string(), - )) - } else { - Ok(GeomProps { - coords, - altitude_mode, - extrude, - tessellate, - }) - } + + Ok(GeomProps { + coords, + altitude_mode, + extrude, + tessellate, + }) } fn read_float(&mut self) -> Result { @@ -1763,4 +1758,23 @@ mod tests { Kml::KmlDocument(_) )); } + + #[test] + fn test_parse_empty_coordinates() { + let kml_str = r#" + + absolute + + + "#; + + assert_eq!( + Kml::::from_str(kml_str).unwrap(), + Kml::LineString(LineString { + coords: vec![], + altitude_mode: types::AltitudeMode::Absolute, + ..Default::default() + }) + ); + } }