Skip to content

Commit 7077d71

Browse files
committedJul 11, 2015
Merge pull request #1464 from ipfs/fix/filters-offline
error out swarm filter when no daemon is online
2 parents d465665 + e8d825d commit 7077d71

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎core/commands/swarm.go

+10
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,11 @@ Filters default to those specified under the "Swarm.AddrFilters" config key.
392392
return
393393
}
394394

395+
if n.PeerHost == nil {
396+
res.SetError(errNotOnline, cmds.ErrNormal)
397+
return
398+
}
399+
395400
snet, ok := n.PeerHost.Network().(*swarm.Network)
396401
if !ok {
397402
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.
434439
return
435440
}
436441

442+
if n.PeerHost == nil {
443+
res.SetError(errNotOnline, cmds.ErrNormal)
444+
return
445+
}
446+
437447
snet, ok := n.PeerHost.Network().(*swarm.Network)
438448
if !ok {
439449
res.SetError(errors.New("failed to cast network to swarm network"), cmds.ErrNormal)

0 commit comments

Comments
 (0)
Please sign in to comment.