summaryrefslogtreecommitdiffstats
path: root/src/event_exec.rs
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2023-09-27 16:07:23 +0200
committerqkzk <qu3nt1n@gmail.com>2023-09-27 16:07:23 +0200
commitb8e24a551cc3afb3458c64804a0652e93fcba92f (patch)
tree14c9b67b51d1bcc12ebe03626593029a33523f7b /src/event_exec.rs
parent44263aa67d23902b924c5456924f1d75d5b01031 (diff)
replace option unwrap by context
Diffstat (limited to 'src/event_exec.rs')
-rw-r--r--src/event_exec.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/event_exec.rs b/src/event_exec.rs
index 3a86a2b..cc1e7f2 100644
--- a/src/event_exec.rs
+++ b/src/event_exec.rs
@@ -837,8 +837,12 @@ impl EventAction {
return Ok(());
};
if let Mode::Normal | Mode::Tree = status.selected_non_mut().mode {
- let first_path = &status.flagged.content[0].to_str().unwrap();
- let second_path = &status.flagged.content[1].to_str().unwrap();
+ let first_path = &status.flagged.content[0]
+ .to_str()
+ .context("Couldn't parse filename")?;
+ let second_path = &status.flagged.content[1]
+ .to_str()
+ .context("Couldn't parse filename")?;
status.selected().preview = Preview::diff(first_path, second_path)?;
let tab = status.selected();
tab.window.reset(tab.preview.len());