diff --git a/objdiff-core/src/obj/read.rs b/objdiff-core/src/obj/read.rs index 6b01d04..dad6427 100644 --- a/objdiff-core/src/obj/read.rs +++ b/objdiff-core/src/obj/read.rs @@ -431,9 +431,9 @@ fn line_info(obj_file: &File<'_>, sections: &mut [ObjSection], obj_data: &[u8]) let mut text_sections = obj_file.sections().filter(|s| s.kind() == SectionKind::Text); let section_index = text_sections.next().map(|s| s.index().0); - let mut lines = section_index.map(|index| { - &mut sections.iter_mut().find(|s| s.orig_index == index).unwrap().line_info - }); + let mut lines = section_index + .and_then(|index| sections.iter_mut().find(|s| s.orig_index == index)) + .map(|s| &mut s.line_info); let mut rows = program.rows(); while let Some((_header, row)) = rows.next_row()? {