1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 09:59:13 +08:00

type check to avoid panic

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
Jeromy
2016-07-15 10:42:19 -07:00
parent 921ae0e964
commit c5318e892e

View File

@ -162,7 +162,13 @@ included in the output of this command.
return 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) output, err := config.HumanOutput(cfg)
if err != nil { if err != nil {