Skip to content

Commit

Permalink
read: Make dwo_name() return Error::MissingUnitDie if appropriate (#693)
Browse files Browse the repository at this point in the history
To follow the pattern in the rest of the code base.
  • Loading branch information
Enselic committed Jan 31, 2024
1 parent 49d872e commit a0367e9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/read/dwarf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,11 +1046,8 @@ impl<R: Reader> Unit<R> {
/// The returned value is relative to this unit's `comp_dir`.
pub fn dwo_name(&self) -> Result<Option<AttributeValue<R>>> {
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 {
Expand Down

0 comments on commit a0367e9

Please sign in to comment.