Add non-nil check before logging volume errors.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: b1570baadd76377aaeb7199c95ad6dc11b38f302
Component: engine
This commit is contained in:
Anusha Ragunathan
2017-03-24 16:34:11 -07:00
parent dfbe94cc62
commit 250a383735
+5 -1
View File
@@ -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"