mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Check nil for pointer
This commit is contained in:
parent
812b87c8e6
commit
5b69688b4b
@ -169,6 +169,10 @@ func (c *MaxPDVolumeCountChecker) filterVolumes(volumes []api.Volume, namespace
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if pvc == nil {
|
||||||
|
return fmt.Errorf("PersistentVolumeClaim not found: %q", pvcName)
|
||||||
|
}
|
||||||
|
|
||||||
pvName := pvc.Spec.VolumeName
|
pvName := pvc.Spec.VolumeName
|
||||||
if pvName == "" {
|
if pvName == "" {
|
||||||
return fmt.Errorf("PersistentVolumeClaim is not bound: %q", pvcName)
|
return fmt.Errorf("PersistentVolumeClaim is not bound: %q", pvcName)
|
||||||
@ -186,6 +190,10 @@ func (c *MaxPDVolumeCountChecker) filterVolumes(volumes []api.Volume, namespace
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if pv == nil {
|
||||||
|
return fmt.Errorf("PersistentVolume not found: %q", pvName)
|
||||||
|
}
|
||||||
|
|
||||||
if id, ok := c.filter.FilterPersistentVolume(pv); ok {
|
if id, ok := c.filter.FilterPersistentVolume(pv); ok {
|
||||||
filteredVolumes[id] = true
|
filteredVolumes[id] = true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user