Fix crash on document switch (#690)

fix crash on unwrap
This commit is contained in:
mfish33
2022-06-26 21:25:28 -07:00
committed by GitHub
parent 42db620b3c
commit 55444eea86
+5 -2
View File
@@ -264,16 +264,19 @@ impl<'a> Selected<'a> {
pub fn revert_operation(&mut self) {
for path in self.selected {
self.responses.push_back(
if let Some(transform) = self.original_transforms.get(*path) {
// Push front to stop document switching before sending the transform
self.responses.push_front(
DocumentOperation::SetLayerTransform {
path: path.to_vec(),
transform: (*self.original_transforms.get(*path).unwrap()).to_cols_array(),
transform: transform.to_cols_array(),
}
.into(),
);
}
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct Typing {