From b82101c4cc1615ae355a3e5c5383c7b2042e5be8 Mon Sep 17 00:00:00 2001 From: Alessandro Boch Date: Sun, 15 May 2016 18:10:50 -0700 Subject: [PATCH] Protect cap access in driver() Signed-off-by: Alessandro Boch --- libnetwork/network.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libnetwork/network.go b/libnetwork/network.go index a077f5540d..5072e088c2 100644 --- a/libnetwork/network.go +++ b/libnetwork/network.go @@ -665,7 +665,10 @@ func (n *network) driver(load bool) (driverapi.Driver, error) { c := n.getController() n.Lock() - n.scope = cap.DataScope + // If load is not required, driver, cap and err may all be nil + if cap != nil { + n.scope = cap.DataScope + } if c.cfg.Daemon.IsAgent { // If we are running in agent mode then all networks // in libnetwork are local scope regardless of the