1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-26 07:28:20 +08:00

fix panic caused by accessing config after repo closed

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2015-09-03 09:28:36 -07:00
parent 3fc1854d24
commit ab0c668ab8
14 changed files with 84 additions and 41 deletions

View File

@ -72,7 +72,11 @@ in the bootstrap list).
return
}
defer r.Close()
cfg := r.Config()
cfg, err := r.Config()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
deflt, _, err := req.Option("default").Bool()
if err != nil {
@ -148,7 +152,11 @@ var bootstrapRemoveCmd = &cmds.Command{
return
}
defer r.Close()
cfg := r.Config()
cfg, err := r.Config()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
all, _, err := req.Option("all").Bool()
if err != nil {
@ -197,7 +205,11 @@ var bootstrapListCmd = &cmds.Command{
return
}
defer r.Close()
cfg := r.Config()
cfg, err := r.Config()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
peers, err := cfg.BootstrapPeers()
if err != nil {