Skip to content

Commit

Permalink
Fix bug in offsets-parser that led to a crash on stray ampersands in …
Browse files Browse the repository at this point in the history
…the input
  • Loading branch information
jbaiter committed Jul 9, 2019
1 parent 16dfba2 commit daecb07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion offsets-parser/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ fn main() -> Result<()> {
};
let word_re = get_regex(&ocr_text);
for cap in word_re.captures_iter(&ocr_text) {
let text = decode_html_entities(&cap["text"]).unwrap();
let text = match decode_html_entities(&cap["text"]) {
Ok(t) => t,
Err(_) => (&cap["text"]).to_string()
};
match cap.get(0) {
Some(mat) => write!(out_writer, "{}{}{} ", text, delimiter, mat.start())?,
None => ()
Expand Down

0 comments on commit daecb07

Please sign in to comment.