Skip to content

Commit 0e966bd

Browse files
authored
Merge pull request #2042 from Urgau/fix-crash-md-data
Fix panic when not finding the data inside the markdown
2 parents 2c61866 + 83ce275 commit 0e966bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/interactions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ where
157157
let all = self.get_current_markdown()?;
158158
let start = self.data_section_start();
159159
let end = self.data_section_end();
160-
let start_idx = all.find(&start).unwrap();
161-
let end_idx = all.find(&end).unwrap();
160+
let start_idx = all.find(&start)?;
161+
let end_idx = all.find(&end)?;
162162
let text = &all[(start_idx + start.len())..end_idx];
163163
Some(serde_json::from_str(text).unwrap_or_else(|e| {
164164
panic!("deserializing data {:?} failed: {:?}", text, e);

0 commit comments

Comments
 (0)