Skip to content

Commit

Permalink
fix: nvmd use {version} --project throws an error when `.nvmd/proje…
Browse files Browse the repository at this point in the history
…cts.json` does not exist (1111mp/nvm-desktop#130)

Signed-off-by: The1111mp <The1111mp@outlook.com>
  • Loading branch information
1111mp committed Oct 16, 2024
1 parent 28a66f0 commit 0f6ea75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/run/nvmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ fn update_projects_file(
) -> Result<()> {
if let Some(mut projects_path) = NVMD_PATH.clone() {
projects_path.push("projects.json");
let mut json_obj = read_json(&projects_path)?;
let mut json_obj = read_json(&projects_path).unwrap_or(json!([]));
let mut not_exist = true;
if let Some(projects) = json_obj.as_array_mut() {
for project in projects.iter_mut() {
Expand Down

0 comments on commit 0f6ea75

Please sign in to comment.