Don't panic when collaborating with older Zed versions (#7162)

Older Zed versions may send a buffer id of 0, which is no-longer
supported. (as of #6993)

This doesn't fix that, but it does ensure that we don't panic in the
workspace by maintaining the invariant that from_proto_state returns
Some(Task) if the variant matches.

It also converts the panic to an error should something similar happen
again in the future.


Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-01-31 11:46:03 -07:00 committed by GitHub
parent 59f77d316f
commit 689d43047d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 11 deletions

View file

@ -2784,8 +2784,10 @@ impl Workspace {
item_tasks.push(task);
leader_view_ids.push(id);
break;
} else {
assert!(variant.is_some());
} else if variant.is_none() {
Err(anyhow!(
"failed to construct view from leader (maybe from a different version of zed?)"
))?;
}
}
}