error out swarm filter when no daemon is online
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Jul 10, 2015 at 13:10 UTC
e8d825de25a2bff9c233c72f52014a99e344da00
1 file changed
+10
core/commands/swarm.go
+10
@@ -392,6 +392,11 @@ Filters default to those specified under the "Swarm.AddrFilters" config key.
392
return
393
}
394
395
+ if n.PeerHost == nil {
396
+ res.SetError(errNotOnline, cmds.ErrNormal)
397
+ return
398
+ }
399
+
400
snet, ok := n.PeerHost.Network().(*swarm.Network)
401
if !ok {
402
res.SetError(errors.New("failed to cast network to swarm network"), cmds.ErrNormal)
@@ -434,6 +439,11 @@ add your filters to the ipfs config file.
439
return
440
}
441
442
+ if n.PeerHost == nil {
443
+ res.SetError(errNotOnline, cmds.ErrNormal)
444
+ return
445
+ }
446
+
447
snet, ok := n.PeerHost.Network().(*swarm.Network)
448
if !ok {
449
res.SetError(errors.New("failed to cast network to swarm network"), cmds.ErrNormal)