提交 81fe75fa 编写于 作者: S stoneshi-yunify

fix: add nil check for storage class name

Signed-off-by: Nstoneshi-yunify <70880165+stoneshi-yunify@users.noreply.github.com>
上级 6f12f72d
......@@ -107,7 +107,7 @@ func (s *storageClassesSearcher) countPersistentVolumeClaims(name string) int {
var count int
for _, pvc := range pvcs {
if *pvc.Spec.StorageClassName == name || (pvc.Annotations != nil && pvc.Annotations[corev1.BetaStorageClassAnnotation] == name) {
if (pvc.Spec.StorageClassName != nil && *pvc.Spec.StorageClassName == name) || (pvc.Annotations != nil && pvc.Annotations[corev1.BetaStorageClassAnnotation] == name) {
count++
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册