chiark / gitweb /
shapelib: Do not "note" the nonexistent SVG for magic items
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 14 May 2022 18:07:19 +0000 (19:07 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 14 May 2022 18:09:56 +0000 (19:09 +0100)
These do not need processing during bundle upload.  Indeed, attempting
it causes it to fail since there isn't actually any SVG.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/shapelib.rs

index 44f18e3def77679dbe085a4d26289e2b982b4c6e..110a988df7ecef39577ae75170e0ddfe9b912ea2 100644 (file)
@@ -1016,6 +1016,9 @@ pub trait LibrarySource: LibrarySvgNoter {
   fn svg_noter(&mut self) -> &mut dyn LibrarySvgNoter;
 }
 
+pub struct NullLibrarySvgNoter;
+impl LibrarySvgNoter for NullLibrarySvgNoter { }
+
 struct BuiltinLibrary<'l> {
   catalogue_data: &'l str,
   dirname: &'l str,
@@ -1303,7 +1306,8 @@ fn process_files_entry(
           error,
         })?;
 
-      l.add_item(src, src_name, &item_name, CatEnt::Magic {
+      l.add_item(&mut NullLibrarySvgNoter, // there's no SVG for *this* item
+                 src_name, &item_name, CatEnt::Magic {
         group: group.clone(),
         spec: spec.into(),
       })?;