From aa1b981f09e9e209336a5f374b4f6e43077a739e Mon Sep 17 00:00:00 2001
From: sam <43527203+bytemunch@users.noreply.github.com>
Date: Fri, 13 Oct 2023 09:38:04 +0100
Subject: [PATCH] fix for #88 (#90)

---
 src/input.rs | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/input.rs b/src/input.rs
index af51900..3e1b84e 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -574,13 +574,16 @@ pub(crate) fn undo_redo(
     >,
     mut evw_changed: EventWriter<CosmicTextChanged>,
 ) {
-    if active_editor.0.is_none() {
-        return;
-    }
+    let entity = match active_editor.0 {
+        Some(entity) => entity,
+        None => return,
+    };
 
-    let entity = active_editor.0.unwrap();
+    let (mut editor, attrs, mut edit_history) = match editor_q.get_mut(entity) {
+        Ok(components) => components,
+        Err(_) => return,
+    };
 
-    let (mut editor, attrs, mut edit_history) = editor_q.get_mut(entity).unwrap();
     let command = keypress_command(&keys);
 
     let attrs = &attrs.0;
-- 
GitLab