Skip to content

Commit

Permalink
check for null before dereferencing (#786)
Browse files Browse the repository at this point in the history
Fixes #785.

Signed-off-by: Kingdon Barrett <kingdon.b@nd.edu>
  • Loading branch information
Kingdon Barrett committed Mar 27, 2020
1 parent 2e3cfdb commit f967e44
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/k8s/volumes/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ func checkPVCValues(pvc *apiv1.PersistentVolumeClaim, dev *model.Dev) error {
)
}
if dev.PersistentVolumeStorageClass() != "" {
if dev.PersistentVolumeStorageClass() != *pvc.Spec.StorageClassName {
if pvc.Spec.StorageClassName == nil {
return fmt.Errorf(
"current okteto volume storageclass is '' instead of '%s'. Run 'okteto down -v' and try again",
dev.PersistentVolumeStorageClass(),
)
} else if dev.PersistentVolumeStorageClass() != *pvc.Spec.StorageClassName {
return fmt.Errorf(
"current okteto volume storageclass is '%s' instead of '%s'. Run 'okteto down -v' and try again",
*pvc.Spec.StorageClassName,
Expand Down

0 comments on commit f967e44

Please sign in to comment.