From b1570baadd76377aaeb7199c95ad6dc11b38f302 Mon Sep 17 00:00:00 2001 From: Anusha Ragunathan Date: Fri, 24 Mar 2017 10:51:22 -0700 Subject: [PATCH] Add non-nil check before logging volume errors. Signed-off-by: Anusha Ragunathan --- volume/store/store.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/volume/store/store.go b/volume/store/store.go index f1eb2ccf06..55ec0cd044 100644 --- a/volume/store/store.go +++ b/volume/store/store.go @@ -542,7 +542,11 @@ func lookupVolume(driverName, volumeName string) (volume.Volume, error) { if err != nil { err = errors.Cause(err) if _, ok := err.(net.Error); ok { - return nil, errors.Wrapf(err, "error while checking if volume %q exists in driver %q", v.Name(), v.DriverName()) + if v != nil { + volumeName = v.Name() + driverName = v.DriverName() + } + return nil, errors.Wrapf(err, "error while checking if volume %q exists in driver %q", volumeName, driverName) } // At this point, the error could be anything from the driver, such as "no such volume"