Skip to content

Commit 71f958c

Browse files
authored
fix: avoid field access from nil object (#1020)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 0c2bbba commit 71f958c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ledger/common/certs.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,11 +728,11 @@ func (c *StakeVoteDelegationCertificate) Utxorpc() *utxorpc.Certificate {
728728

729729
// Extract DRep credential if it exists (AddrKeyHash or ScriptHash)
730730
if drepProto != nil {
731-
switch v := drepProto.GetDrep().(type) {
731+
switch drepProto.GetDrep().(type) {
732732
case *utxorpc.DRep_AddrKeyHash:
733-
drepBytes = v.AddrKeyHash
733+
drepBytes = drepProto.GetAddrKeyHash()
734734
case *utxorpc.DRep_ScriptHash:
735-
drepBytes = v.ScriptHash
735+
drepBytes = drepProto.GetScriptHash()
736736
}
737737
}
738738

@@ -866,11 +866,11 @@ func (c *StakeVoteRegistrationDelegationCertificate) Utxorpc() *utxorpc.Certific
866866
var drepBytes []byte
867867

868868
if drepProto != nil {
869-
switch v := drepProto.GetDrep().(type) {
869+
switch drepProto.GetDrep().(type) {
870870
case *utxorpc.DRep_AddrKeyHash:
871-
drepBytes = v.AddrKeyHash
871+
drepBytes = drepProto.GetAddrKeyHash()
872872
case *utxorpc.DRep_ScriptHash:
873-
drepBytes = v.ScriptHash
873+
drepBytes = drepProto.GetScriptHash()
874874
}
875875
}
876876

0 commit comments

Comments
 (0)