Browse code

Add non-nil check before logging volume errors.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
(cherry picked from commit b1570baadd76377aaeb7199c95ad6dc11b38f302)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>

Anusha Ragunathan authored on 2017/03/25 02:51:22
Showing 1 changed files
... ...
@@ -519,7 +519,11 @@ func lookupVolume(driverName, volumeName string) (volume.Volume, error) {
519 519
 	if err != nil {
520 520
 		err = errors.Cause(err)
521 521
 		if _, ok := err.(net.Error); ok {
522
-			return nil, errors.Wrapf(err, "error while checking if volume %q exists in driver %q", v.Name(), v.DriverName())
522
+			if v != nil {
523
+				volumeName = v.Name()
524
+				driverName = v.DriverName()
525
+			}
526
+			return nil, errors.Wrapf(err, "error while checking if volume %q exists in driver %q", volumeName, driverName)
523 527
 		}
524 528
 
525 529
 		// At this point, the error could be anything from the driver, such as "no such volume"