mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-27 16:07:42 +08:00
type check to avoid panic
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
@ -162,7 +162,13 @@ included in the output of this command.
|
||||
return
|
||||
}
|
||||
|
||||
delete(cfg["Identity"].(map[string]interface{}), "PrivKey")
|
||||
idmap, ok := cfg["Identity"].(map[string]interface{})
|
||||
if !ok {
|
||||
res.SetError(fmt.Errorf("config has no identity"), cmds.ErrNormal)
|
||||
return
|
||||
}
|
||||
|
||||
delete(idmap, "PrivKey")
|
||||
|
||||
output, err := config.HumanOutput(cfg)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user