Skip to content

Commit

Permalink
Simplify entry id identification
Browse files Browse the repository at this point in the history
  • Loading branch information
kkent030315 committed Dec 11, 2024
1 parent 2d7749a commit 9af1f1d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/pe/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,10 +1148,10 @@ impl<'a> VersionInfo<'a> {
file_alignment: u32,
opts: &options::ParseOptions,
) -> error::Result<Option<Self>> {
let it = it.collect::<Result<Vec<_>, _>>()?;
let it = it.iter().find(|e| e.id() == Some(RT_VERSION));

if let Some(entry) = it {
if let Some(entry) = it
.filter_map(|x| x.ok())
.find(|x| x.id() == Some(RT_VERSION))
{
let offset_to_data =
match entry.recursive_next_depth(bytes, |e| e.offset_to_data().is_none())? {
Some(next) => match next.offset_to_data() {
Expand Down Expand Up @@ -1226,10 +1226,10 @@ impl<'a> ManifestData<'a> {
file_alignment: u32,
opts: &options::ParseOptions,
) -> error::Result<Option<Self>> {
let it = it.collect::<Result<Vec<_>, _>>()?;
let it = it.iter().find(|e| e.id() == Some(RT_MANIFEST));

if let Some(entry) = it {
if let Some(entry) = it
.filter_map(|x| x.ok())
.find(|x| x.id() == Some(RT_VERSION))
{
let offset_to_data =
match entry.recursive_next_depth(bytes, |e| e.offset_to_data().is_none())? {
Some(next) => match next.offset_to_data() {
Expand Down

0 comments on commit 9af1f1d

Please sign in to comment.