Skip to content

Commit

Permalink
don't panic if no default profile is found
Browse files Browse the repository at this point in the history
  • Loading branch information
jrperritt committed Jul 27, 2015
1 parent de2f457 commit 675e3b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions commandoptions/configfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func ConfigFile(c *cli.Context, have map[string]Cred, need map[string]string) er
return err
}

if section == nil {
return nil
}

for opt := range need {
if val := section.Key(opt).String(); val != "" {
have[opt] = Cred{Value: val, From: fmt.Sprintf("config file (profile: %s)", section.Name())}
Expand Down
6 changes: 5 additions & 1 deletion handler/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ func (ctx *Context) handleGlobalOptions() error {
if err != nil {
return err
}
defaultKeysHash := defaultSection.KeysHash()

defaultKeysHash := map[string]string{}
if defaultSection != nil {
defaultKeysHash = defaultSection.KeysHash()
}

have := make(map[string]commandoptions.Cred)
want := map[string]string{
Expand Down

0 comments on commit 675e3b7

Please sign in to comment.