From 4711c062b0fd8409eef7ed6ed0963b638765cc7f Mon Sep 17 00:00:00 2001
From: zhangyu235 <zhangyu235@huawei.com>
Date: Mon, 18 Feb 2019 21:57:38 +0800
Subject: [PATCH 101/111] daeamon: add judge for client in case of
 panic

reason:Add judge for client in monitorDaemon(), in case of
null ptr error return cause panic.

Change-Id: Ia0dd64ba0341414d2dbe213a53daa94e2c5d1723
---
 components/engine/libcontainerd/supervisor/remote_daemon.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/components/engine/libcontainerd/supervisor/remote_daemon.go b/components/engine/libcontainerd/supervisor/remote_daemon.go
index 45cc3c3032..62ea58c8b4 100644
--- a/components/engine/libcontainerd/supervisor/remote_daemon.go
+++ b/components/engine/libcontainerd/supervisor/remote_daemon.go
@@ -318,8 +318,10 @@ func (r *remote) monitorDaemon(ctx context.Context) {
 			r.killDaemon()
 		}
 
-		client.Close()
-		client = nil
+		if client != nil {
+			client.Close()
+			client = nil
+		}
 		r.daemonPid = -1
 		delay = nil
 		transientFailureCount = 0
-- 
2.17.1

