From 1ae97a80ce38fa0696e7fbe5f3386f1b803f3335 Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Wed, 21 May 2025 17:28:15 -0400 Subject: [PATCH] fix: avoid field access from nil object Signed-off-by: Chris Gianelloni --- ledger/common/certs.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ledger/common/certs.go b/ledger/common/certs.go index 21794866..2bf304e5 100644 --- a/ledger/common/certs.go +++ b/ledger/common/certs.go @@ -728,11 +728,11 @@ func (c *StakeVoteDelegationCertificate) Utxorpc() *utxorpc.Certificate { // Extract DRep credential if it exists (AddrKeyHash or ScriptHash) if drepProto != nil { - switch v := drepProto.GetDrep().(type) { + switch drepProto.GetDrep().(type) { case *utxorpc.DRep_AddrKeyHash: - drepBytes = v.AddrKeyHash + drepBytes = drepProto.GetAddrKeyHash() case *utxorpc.DRep_ScriptHash: - drepBytes = v.ScriptHash + drepBytes = drepProto.GetScriptHash() } } @@ -866,11 +866,11 @@ func (c *StakeVoteRegistrationDelegationCertificate) Utxorpc() *utxorpc.Certific var drepBytes []byte if drepProto != nil { - switch v := drepProto.GetDrep().(type) { + switch drepProto.GetDrep().(type) { case *utxorpc.DRep_AddrKeyHash: - drepBytes = v.AddrKeyHash + drepBytes = drepProto.GetAddrKeyHash() case *utxorpc.DRep_ScriptHash: - drepBytes = v.ScriptHash + drepBytes = drepProto.GetScriptHash() } }