Skip to content

Commit

Permalink
🐛 avoid panic by using GetMd5() instead of Md5.Get (#508)
Browse files Browse the repository at this point in the history
This PR fixes a panic caused by using bgpConfig.Md5.Get() in situations
where the MD5 hash isn't set. We use GetMd5() instead which checks for
this for us.
  • Loading branch information
k8s-ci-robot committed Feb 5, 2024
2 parents 9ceac2f + f6806b7 commit 036c57b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion metal/bgp.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (b *bgp) enableBGP() error {
// - bgpConfig struct does not have Status=="disabled"
if err == nil && bgpConfig != nil && bgpConfig.GetId() != "" && bgpConfig.GetStatus() != metal.BGPCONFIGSTATUS_DISABLED {
b.localASN = int(bgpConfig.GetAsn())
b.bgpPass = *bgpConfig.Md5.Get()
b.bgpPass = bgpConfig.GetMd5()
return nil
}

Expand Down

0 comments on commit 036c57b

Please sign in to comment.