Skip to content

Commit 242f75c

Browse files
committed
fix(lib) = use a ? in place of an unwrap
* Lib used to panic when byte stream was not a pdf. * ? should make the lib return an error result
1 parent 9fc19c4 commit 242f75c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ impl<'a> PdfSimpleFont<'a> {
508508
// code point, so we'll use an empty string instead. See issue #76
509509
match unicode_map.entry(code as u32) {
510510
Entry::Vacant(v) => { v.insert("".to_owned()); }
511-
Entry::Occupied(e) => {
511+
Entry::Occupied(_e) => {
512512
panic!("unexpected entry in unicode map")
513513
}
514514
}
@@ -580,7 +580,7 @@ impl<'a> PdfSimpleFont<'a> {
580580
}
581581
assert_eq!(first_char + i - 1, last_char);
582582
} else {
583-
let name = if is_core_font(&base_name) {
583+
let _name = if is_core_font(&base_name) {
584584
&base_name
585585
} else {
586586
warn!("no widths and not core font {:?}", base_name);
@@ -1575,7 +1575,7 @@ impl<'a> Processor<'a> {
15751575
}
15761576

15771577
fn process_stream(&mut self, doc: &'a Document, content: Vec<u8>, resources: &'a Dictionary, media_box: &MediaBox, output: &mut dyn OutputDev, page_num: u32) -> Result<(), OutputError> {
1578-
let content = Content::decode(&content).unwrap();
1578+
let content = Content::decode(&content)?;
15791579
let mut font_table = HashMap::new();
15801580
let mut gs: GraphicsState = GraphicsState {
15811581
ts: TextState {

0 commit comments

Comments
 (0)