From a4b96aff33946d01b3aa0ce83a65d64d04fa9e85 Mon Sep 17 00:00:00 2001 From: Danielle Lancashire Date: Sat, 25 Jan 2020 10:39:21 +0100 Subject: [PATCH] csi: Nil check ToCSIRepresentation implementations --- plugins/csi/plugin.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/csi/plugin.go b/plugins/csi/plugin.go index a9eb6b5ce..cd5ad7555 100644 --- a/plugins/csi/plugin.go +++ b/plugins/csi/plugin.go @@ -101,6 +101,10 @@ type NodePublishVolumeRequest struct { } func (r *NodePublishVolumeRequest) ToCSIRepresentation() *csipbv1.NodePublishVolumeRequest { + if r == nil { + return nil + } + return &csipbv1.NodePublishVolumeRequest{ VolumeId: r.VolumeID, PublishContext: r.PublishContext, @@ -325,6 +329,10 @@ type VolumeCapability struct { } func (c *VolumeCapability) ToCSIRepresentation() *csipbv1.VolumeCapability { + if c == nil { + return nil + } + vc := &csipbv1.VolumeCapability{ AccessMode: &csipbv1.VolumeCapability_AccessMode{ Mode: c.AccessMode.ToCSIRepresentation(),