chiark / gitweb /
bundles: Fix a bug which could cause IE on bundle load
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 15 May 2022 22:32:20 +0000 (23:32 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 15 May 2022 22:38:57 +0000 (23:38 +0100)
We need to make an entry entry in the bundles notes array even if the
hash is missing.  Or we might try to reuse the bundle number, if there
was a failed bundle upload followed by a server restart.

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

index 089286f39b7dec078b98025d9feae273af34a4a5..41b08d642c2d502f930784ba6d53b2ddd798998c 100644 (file)
@@ -1071,6 +1071,8 @@ impl InstanceBundles {
       };
 
       let iu: usize = parsed.index().into();
+      ib.bundles.get_or_extend_with(iu, default);
+
       let hash = match ig.bundle_hashes.hashes.get(iu) {
         Some(Some(hash)) => hash,
         _ => {
@@ -1079,8 +1081,6 @@ impl InstanceBundles {
         }
       };
 
-      ib.bundles.get_or_extend_with(parsed.index().into(), default);
-
       if_let!{ BundleSavefile::Bundle(id) = parsed;
                else continue; }