From: Sergey Matveev Date: Thu, 8 Jul 2021 08:47:51 +0000 (+0300) Subject: Do not panic if some names are not found in nncp-pkt X-Git-Tag: v7.2.0^2~8 X-Git-Url: http://www.git.cypherpunks.ru/?a=commitdiff_plain;h=26bb6f57a7ca085a08c8d0c1f0e715e6f928bfc7;p=nncp.git Do not panic if some names are not found in nncp-pkt --- diff --git a/src/cmd/nncp-pkt/main.go b/src/cmd/nncp-pkt/main.go index 3cd59ec..58a4599 100644 --- a/src/cmd/nncp-pkt/main.go +++ b/src/cmd/nncp-pkt/main.go @@ -84,7 +84,7 @@ func doPlain(ctx *nncp.Ctx, pkt nncp.Pkt, dump, decompress bool) { case nncp.PktTypeTrns: path = nncp.Base32Codec.EncodeToString(pkt.Path[:pkt.PathLen]) node, err := ctx.FindNode(path) - if err != nil { + if err == nil { path = fmt.Sprintf("%s (%s)", path, node.Name) } case nncp.PktTypeArea: @@ -119,7 +119,9 @@ func doEncrypted( recipientNode := ctx.Neigh[*pktEnc.Recipient] if recipientNode == nil { area = ctx.AreaId2Area[nncp.AreaId(*pktEnc.Recipient)] - recipientName = "area " + area.Name + if area != nil { + recipientName = "area " + area.Name + } } else { recipientName = recipientNode.Name }