From b770d387bf93479c18deb7bccc4faf05278f4494 Mon Sep 17 00:00:00 2001 From: Callan Bryant Date: Mon, 26 Oct 2020 22:39:08 +0000 Subject: [PATCH] fix unititialised IPNet marshalling --- exttypes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exttypes.go b/exttypes.go index d43c6af..8e67fa5 100644 --- a/exttypes.go +++ b/exttypes.go @@ -24,7 +24,11 @@ func (n *JSONIPNet) UnmarshalJSON(b []byte) error { } func (n *JSONIPNet) String() string { - return n.IPNet.String() + if len(n.IPNet.IP) == 0 { + return "\"\"" + } else { + return n.IPNet.String() + } } type JSONKey struct {