Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced CoffHeader::strings unwrap with try. #222

Merged
merged 1 commit into from
May 10, 2020

Conversation

ExPixel
Copy link
Contributor

@ExPixel ExPixel commented May 10, 2020

The unwrap was causing some problems in my code and it seems unnecessary since the function returns the same Result type as what is being unwrapped anyway.

Copy link
Owner

@m4b m4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

@@ -99,7 +99,7 @@ impl CoffHeader {
let offset = self.pointer_to_symbol_table as usize
+ symbol::SymbolTable::size(self.number_of_symbol_table as usize);
let length = bytes.pread_with::<u32>(offset, scroll::LE)? as usize;
Ok(strtab::Strtab::parse(bytes, offset, length, 0).unwrap())
Ok(strtab::Strtab::parse(bytes, offset, length, 0)?)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting; not sure why this was ever unwrapped, parsing the strtab should be fallible here, so it must have gone unnoticed

@m4b m4b merged commit 41c6c9d into m4b:master May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants