Skip to content

Commit 2524166

Browse files
committed
Don't panic if there is no onboard cert
dev.Onboard can be nil, so we need to check for that before accessing the cert. Signed-off-by: Shahriyar Jalayeri <[email protected]>
1 parent 0e95654 commit 2524166

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/driver/file/device_manager_file.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,9 @@ func (d *DeviceManager) checkValidOnboardSerial(cert *x509.Certificate, serial s
11371137
func (d *DeviceManager) getOnboardSerialDevice(cert *x509.Certificate, serial string) *uuid.UUID {
11381138
certStr := string(cert.Raw)
11391139
for uid, dev := range d.devices {
1140+
if dev.Onboard == nil {
1141+
continue
1142+
}
11401143
dCertStr := string(dev.Onboard.Raw)
11411144
if dCertStr == certStr && serial == dev.Serial {
11421145
return &uid

0 commit comments

Comments
 (0)