Skip to content

Commit 31e9c14

Browse files
AetiasHaxencounter
authored andcommitted
Allow None section when parsing line info
Fixes an error upon ending the last DWARF sequence
1 parent 94f1f07 commit 31e9c14

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

objdiff-core/src/obj/read.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,14 @@ fn line_info(obj_file: &File<'_>, sections: &mut [ObjSection]) -> Result<()> {
346346
if row.end_sequence() {
347347
// The next row is the start of a new sequence, which means we must
348348
// advance to the next .text section.
349-
let section_index = text_sections
350-
.next()
351-
.ok_or_else(|| anyhow!("Next text section not found for line info"))?
352-
.index()
353-
.0;
354-
lines = sections
355-
.iter_mut()
356-
.find(|s| s.orig_index == section_index)
357-
.map(|s| &mut s.line_info);
349+
let section_index = text_sections.next().map(|s| s.index().0);
350+
lines = section_index.map(|index| {
351+
&mut sections
352+
.iter_mut()
353+
.find(|s| s.orig_index == index)
354+
.unwrap()
355+
.line_info
356+
});
358357
}
359358
}
360359
}

0 commit comments

Comments
 (0)