Fix crash on document switch (#690)

fix crash on unwrap
This commit is contained in:
mfish33
2022-06-26 22:25:28 -06:00
committed by Keavon Chambers
parent 581ed81747
commit 7f15cac5e2
+5 -2
View File
@@ -264,16 +264,19 @@ impl<'a> Selected<'a> {
pub fn revert_operation(&mut self) { pub fn revert_operation(&mut self) {
for path in self.selected { 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 { DocumentOperation::SetLayerTransform {
path: path.to_vec(), path: path.to_vec(),
transform: (*self.original_transforms.get(*path).unwrap()).to_cols_array(), transform: transform.to_cols_array(),
} }
.into(), .into(),
); );
} }
} }
} }
}
#[derive(Debug, Clone, PartialEq, Eq, Default)] #[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct Typing { pub struct Typing {