diff --git a/crates/workspace/src/persistence/model.rs b/crates/workspace/src/persistence/model.rs index c5251f20be9313a50f2256c54823d8839bdfe7fd..c7171116ed703d337fc53a86999f6284b4bcb011 100644 --- a/crates/workspace/src/persistence/model.rs +++ b/crates/workspace/src/persistence/model.rs @@ -351,8 +351,17 @@ impl SerializedPane { } })?; } + + // `items` contains `None` for each item that failed to deserialize. + // Only `Some` entries are added to the pane above, so the pinned + // count must only count those — not the total serialized count. + let pinned_count = items + .iter() + .take(self.pinned_count) + .filter(|item| item.is_some()) + .count(); pane.update(cx, |pane, _| { - pane.set_pinned_count(self.pinned_count.min(items.len())); + pane.set_pinned_count(pinned_count); })?; anyhow::Ok(items)