Skip to content

Commit

Permalink
cli: Fix anchor account command panicking outside of workspace (#2620)
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto authored Sep 1, 2023
1 parent dcf5928 commit b9fa898
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- cli: Fix `anchor build --no-docs` adding docs to the IDL ([#2575](https://github.com/coral-xyz/anchor/pull/2575)).
- ts: Load workspace programs on-demand rather than loading all of them at once ([#2579](https://github.com/coral-xyz/anchor/pull/2579)).
- lang: Fix `associated_token::token_program` constraint ([#2603](https://github.com/coral-xyz/anchor/pull/2603)).
- cli: Fix `anchor account` command panicking outside of workspace ([#2620](https://github.com/coral-xyz/anchor/pull/2620)).

### Breaking

Expand Down
11 changes: 6 additions & 5 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2594,11 +2594,12 @@ fn account(
},
);

let mut cluster = &Config::discover(cfg_override)
.map(|cfg| cfg.unwrap())
.map(|cfg| cfg.provider.cluster.clone())
.unwrap_or(Cluster::Localnet);
cluster = cfg_override.cluster.as_ref().unwrap_or(cluster);
let cluster = match &cfg_override.cluster {
Some(cluster) => cluster.clone(),
None => Config::discover(cfg_override)?
.map(|cfg| cfg.provider.cluster.clone())
.unwrap_or(Cluster::Localnet),
};

let data = create_client(cluster.url()).get_account_data(&address)?;
if data.len() < 8 {
Expand Down

1 comment on commit b9fa898

@vercel
Copy link

@vercel vercel bot commented on b9fa898 Sep 1, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

anchor-docs – ./

anchor-docs-git-master-200ms.vercel.app
anchor-docs-200ms.vercel.app
www.anchor-lang.com
anchor-lang.com

Please sign in to comment.