chiark / gitweb /
shapelib: Promote call to group.d.outline.check()
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 May 2022 18:22:44 +0000 (19:22 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 May 2022 18:24:09 +0000 (19:24 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/shapelib.rs

index 6ee0e488adc8b643f4b046da21814c5fafa5ff56..b346327d5f133c858b13d65bda9ea87697184a26 100644 (file)
@@ -801,13 +801,19 @@ pub fn load_catalogue(libname: &str, src: &mut dyn LibrarySource)
       groupname: groupname.clone(),
       d, mformat,
     });
-    group.d.outline.check(&group)?;
+
+    // We do this here rather than in the files loop because
+    //  1. we want to check it even if there are no files specified
+    //  2. this is OK because the group doesn't change from here on
+    let outline_calculable = group.d.outline.check(&group)?.into();
+
     if [
       group.d.flip,
       group.d.back.is_some(),
     ].iter().filter(|x|**x).count() > 1 {
       throw!(LLE::MultipleMultipleFaceDefinitions)
     }
+
     for fe in gdefn.files.0 {
       #[throws(SubstError)]
       fn subst(before: &str, needle: &'static str, replacement: &str)
@@ -833,8 +839,6 @@ pub fn load_catalogue(libname: &str, src: &mut dyn LibrarySource)
           + rhs
       }
 
-      let outline_calculable = group.d.outline.check(&group)?.into();
-
       let item_name = format!("{}{}{}", gdefn.item_prefix,
                               fe.item_spec, gdefn.item_suffix);
       let item_name: GoodItemName = item_name.try_into()?;