Skip to content

Commit

Permalink
Merge pull request #20 from stealthrocket/fix-config-panic
Browse files Browse the repository at this point in the history
Fix config panic
  • Loading branch information
chriso authored Apr 18, 2024
2 parents 656da5f + 692d2c4 commit 2f34ae5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func runConfigFlow() error {
}
}

if config.Active != "" {
if config != nil && config.Active != "" {
org, ok := config.Organization[config.Active]
if !ok {
return fmt.Errorf("invalid active organization '%s' found in configuration. Please run `dispatch login` or `dispatch switch`", config.Active)
Expand All @@ -132,7 +132,7 @@ func runConfigFlow() error {
}

if DispatchApiKey == "" {
if len(config.Organization) > 0 {
if config != nil && len(config.Organization) > 0 {
return fmt.Errorf("No organization selected. Please run `dispatch switch` to select one.")
}
return fmt.Errorf("Please run `dispatch login` to login to Dispatch. Alternatively, set the DISPATCH_API_KEY environment variable, or provide an --api-key (-k) on the command line.")
Expand Down

0 comments on commit 2f34ae5

Please sign in to comment.