Skip to content

Commit 4a5fee6

Browse files
committed
fix potential panic when checking VC++ Redistributable version
The previous code used `?` to propagate an error from `get_vc_redist_version`, but the parent function does not return a Result. This change uses `unwrap_or_default()` to safely handle the absence of a version.
1 parent beeb256 commit 4a5fee6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn check_msvc_version() {
6464
}
6565
}
6666

67-
if let Some(version) = get_vc_redist_version("x64")? {
67+
if let Some(version) = get_vc_redist_version("x64").unwrap_or_default() {
6868
eprintln!("Detected VC++ Redistributable version (x64): {}", version);
6969
let threshold = "14.44.0.0";
7070
if !is_version_at_least(&version, threshold) {

0 commit comments

Comments
 (0)