Skip to content

Commit

Permalink
Simplify the expression with same semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
kkent030315 committed Oct 23, 2024
1 parent 180cbb2 commit e32101c
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/pe/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,8 @@ impl<'a> TlsData<'a> {

// VA to RVA
let rva = itd.address_of_index as usize - image_base;
let offset = utils::find_offset(rva, sections, file_alignment, opts).ok_or_else(|| {
error::Error::Malformed(format!(
"cannot map tls address_of_index rva ({:#x}) into offset",
rva
))
});

slot = match offset {
Ok(offset) => Some(bytes.pread_with::<u32>(offset, scroll::LE)?),
Err(_) => None,
};
let offset = utils::find_offset(rva, sections, file_alignment, opts);
slot = offset.and_then(|x| bytes.pread_with::<u32>(x, scroll::LE).ok());
}

// Parse the callbacks if any
Expand Down

0 comments on commit e32101c

Please sign in to comment.