From 79fe7aadd6ebf7c42ea4679847e7ddfd34a9cb3e Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 3 Jul 2014 14:33:56 -0400 Subject: [PATCH] Log an error when json encoding of peers.json fails. --- addrmanager.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addrmanager.go b/addrmanager.go index 7ae57700..577175ba 100644 --- a/addrmanager.go +++ b/addrmanager.go @@ -481,7 +481,10 @@ func (a *AddrManager) savePeers() { } enc := json.NewEncoder(w) defer w.Close() - enc.Encode(&sam) + if err := enc.Encode(&sam); err != nil { + amgrLog.Errorf("Failed to encode %s: %v", filePath, err) + return + } } // loadPeers loads the known address from the saved file. If empty, missing, or