From 8ed5d632166476bf8618391e275bfb4d4e54726c Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期三, 30 十二月 2020 15:22:52 +0800
Subject: [PATCH] 判断handlers是否为空

---
 micronode.go |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/micronode.go b/micronode.go
index 1cc69d7..87e6bcf 100644
--- a/micronode.go
+++ b/micronode.go
@@ -211,10 +211,15 @@
 }
 
 func (ms *MicroNode) serve(msgR *MsgInfo, p int) {
+	if ms.handlers == nil {
+		return
+	}
+
 	var reqBody Request
 	err := json.Unmarshal(msgR.Body, &reqBody)
 	if err != nil {
 		ms.printLog("serve unmarshal msgR.Body err:", err)
+		return
 	}
 
 	ms.printLog("reqBody:", reqBody)

--
Gitblit v1.8.0