fix(2/bootstrap) catch hidden panic
@mappum any idea what might cause the type to not match here?
Brian Tiger Chow committed
Nov 12, 2014 at 03:02 UTC
3c9fb48699704cb6b5405a1045c703b2c70730cb
1 file changed
+5
-2
core/commands2/bootstrap.go
+5
-2
@@ -7,9 +7,9 @@ import (
7
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
8
mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
9
10
- u "github.com/jbenet/go-ipfs/util"
10
cmds "github.com/jbenet/go-ipfs/commands"
11
config "github.com/jbenet/go-ipfs/config"
12
+ u "github.com/jbenet/go-ipfs/util"
13
)
14
15
type BootstrapOutput struct {
@@ -129,7 +129,10 @@ var bootstrapListCmd = &cmds.Command{
129
}
130
131
func bootstrapMarshaller(res cmds.Response) ([]byte, error) {
132
- v := res.Output().(*BootstrapOutput)
132
+ v, ok := res.Output().(*BootstrapOutput)
133
+ if !ok {
134
+ return nil, u.ErrCast()
135
+ }
136
137
s := ""
138
for _, peer := range v.Peers {