fix unititialised IPNet marshalling

This commit is contained in:
Callan Bryant 2020-10-26 22:39:08 +00:00
parent 34ff77b27a
commit b770d387bf
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA

View File

@ -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 {