Skip to content

Commit 3988955

Browse files
committed
fix: prevent null values for AllDomains
Together with the previous commit, this fixes #26.
1 parent 1d3a6e4 commit 3988955

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

internal/certificatetransparency/ct-parser.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ func leafCertFromX509cert(cert x509.Certificate) certstream.LeafCert {
117117
IsCA: cert.IsCA,
118118
}
119119

120+
// The zero value of DomainsEntry.Data is nil, but we want an empty array - especially for json marshalling later.
121+
if leafCert.AllDomains == nil {
122+
leafCert.AllDomains = []string{}
123+
}
124+
120125
leafCert.Subject = buildSubject(cert.Subject)
121126
if *leafCert.Subject.CN != "" && !leafCert.IsCA {
122127
domainAlreadyAdded := false

0 commit comments

Comments
 (0)