diff --git a/core/commands/swarm.go b/core/commands/swarm.go index d444e1c4bb54..909e77d2f144 100644 --- a/core/commands/swarm.go +++ b/core/commands/swarm.go @@ -509,12 +509,17 @@ func resolveAddresses(ctx context.Context, addrs []string) ([]ma.Multiaddr, erro maddrC := make(chan ma.Multiaddr) - for _, addr := range addrs { + for i, addr := range addrs { maddr, err := ma.NewMultiaddr(addr) if err != nil { return nil, err } + // only way to check for "empty" multiaddrs at the moment. + if len(maddr.Bytes()) == 0 { + return nil, fmt.Errorf("multiaddr %d is empty", i) + } + // check whether address ends in `ipfs/Qm...` if _, last := ma.SplitLast(maddr); last.Protocol().Code == ma.P_IPFS { maddrs = append(maddrs, maddr)