Skip to content

Comments

fix: replace panicking unwrap() calls with descriptive errors in build.rs#149

Open
plasmaDestroyer wants to merge 1 commit intoCCExtractor:masterfrom
plasmaDestroyer:fix/unwrap-panic-build
Open

fix: replace panicking unwrap() calls with descriptive errors in build.rs#149
plasmaDestroyer wants to merge 1 commit intoCCExtractor:masterfrom
plasmaDestroyer:fix/unwrap-panic-build

Conversation

@plasmaDestroyer
Copy link

Problem

In dynamic_linking() in build.rs, two .unwrap() calls can panic with an unhelpful "called unwrap() on None" message:

  • file_stem().unwrap() panics if the path has no valid filename
  • parent().unwrap() panics if the path has no parent directory

Fix

Replaced both with .expect() to get a clear, readable message explaining what went wrong instead of a panic.

Note

Also noticed a similar .unwrap() in the vcpkg_linking module when converting paths to UTF-8. This could potentially panic on Windows if FFmpeg is installed in a path with non-UTF-8 characters, though likely rare. Leaving it out of this PR to keep changes focused, can be addressed separately if needed.

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.

1 participant