From 96b34dcc17bbe0871ec870e1333956770548031c Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Tue, 30 Jan 2024 20:03:49 +0100 Subject: [PATCH] Make dwo_name() return Error::MissingUnitDie if appropriate To follow the pattern in the rest of the code base. --- src/read/dwarf.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/read/dwarf.rs b/src/read/dwarf.rs index 2f8dcb36..e773368c 100644 --- a/src/read/dwarf.rs +++ b/src/read/dwarf.rs @@ -1046,11 +1046,8 @@ impl Unit { /// The returned value is relative to this unit's `comp_dir`. pub fn dwo_name(&self) -> Result>> { let mut entries = self.entries(); - if let None = entries.next_entry()? { - return Ok(None); - } - - let entry = entries.current().unwrap(); + entries.next_entry()?; + let entry = entries.current().ok_or(Error::MissingUnitDie)?; if self.header.version() < 5 { entry.attr_value(constants::DW_AT_GNU_dwo_name) } else {