From 95c683b1bbb07f0109ab1b842eb3fe7b048998ed Mon Sep 17 00:00:00 2001 From: Santhosh Manohar Date: Tue, 15 Nov 2016 09:49:00 -0800 Subject: [PATCH] Add a nil check for sandbox.osSbox Signed-off-by: Santhosh Manohar --- sandbox.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sandbox.go b/sandbox.go index 1ca1271cc7..0329e4b7ee 100644 --- a/sandbox.go +++ b/sandbox.go @@ -427,7 +427,13 @@ func (sb *sandbox) ResolveIP(ip string) string { } func (sb *sandbox) ExecFunc(f func()) error { - return sb.osSbox.InvokeFunc(f) + sb.Lock() + osSbox := sb.osSbox + sb.Unlock() + if osSbox != nil { + return osSbox.InvokeFunc(f) + } + return fmt.Errorf("osl sandbox unavailable in ExecFunc for %v", sb.ContainerID()) } func (sb *sandbox) ResolveService(name string) ([]*net.SRV, []net.IP) {