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
+10 -7
View File
@@ -264,13 +264,16 @@ 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) {
DocumentOperation::SetLayerTransform { // Push front to stop document switching before sending the transform
path: path.to_vec(), self.responses.push_front(
transform: (*self.original_transforms.get(*path).unwrap()).to_cols_array(), DocumentOperation::SetLayerTransform {
} path: path.to_vec(),
.into(), transform: transform.to_cols_array(),
); }
.into(),
);
}
} }
} }
} }