]> Cypherpunks.ru repositories - nncp.git/commitdiff
Do not panic if some names are not found in nncp-pkt
authorSergey Matveev <stargrave@stargrave.org>
Thu, 8 Jul 2021 08:47:51 +0000 (11:47 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 8 Jul 2021 08:47:51 +0000 (11:47 +0300)
src/cmd/nncp-pkt/main.go

index 3cd59ecb8c6813e430e9becb1dcd3add024b90f8..58a45997af2645fa20a0bf89dbe14019f59ed33d 100644 (file)
@@ -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
        }