Skip to content

Commit

Permalink
fix(cli): don't panic when a crate version couldn't be parsed (#5873)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
  • Loading branch information
amrbashir and lucasfernog authored Dec 26, 2022
1 parent 1956a3a commit c260842
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/cli-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"cli.rs": "patch"
---

Fix `tauri info` panicking when parsing crates version on a newly created project without a `Cargo.lock` file.

4 changes: 2 additions & 2 deletions tooling/cli/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,10 @@ fn crate_version(

let crate_version = found_crate_versions
.into_iter()
.map(|v| semver::Version::parse(&v).unwrap())
.map(|v| semver::Version::parse(&v).ok())
.max();
let suffix = match (crate_version, crate_latest_version(name)) {
(Some(version), Some(target_version)) => {
(Some(Some(version)), Some(target_version)) => {
let target_version = semver::Version::parse(&target_version).unwrap();
if version < target_version {
Some(format!(" (outdated, latest: {target_version})"))
Expand Down

0 comments on commit c260842

Please sign in to comment.