From 2cb8afafa624fe7c18747f068c8b1b5ec47011e1 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期一, 27 五月 2019 15:49:28 +0800
Subject: [PATCH] add fix

---
 deliver.go |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/deliver.go b/deliver.go
index e4b7ba4..d518da2 100644
--- a/deliver.go
+++ b/deliver.go
@@ -50,7 +50,11 @@
 func NewServerWithError(m Mode, url string, args ...interface{}) (Deliver, error) {
 
 	if m > ModeStart && m < ModeNNG {
-		return nngServer(m, url, args...), nil
+		s := nngServer(m, url, args...)
+		if s == nil {
+			return nil, errors.New("nng create server error")
+		}
+		return s, nil
 	} else if m == Shm {
 		return shmServer(m, url, args...)
 	}
@@ -61,7 +65,11 @@
 func NewClientWithError(m Mode, url string, args ...interface{}) (Deliver, error) {
 
 	if m > ModeStart && m < ModeNNG {
-		return nngClient(m, url, args...), nil
+		s := nngClient(m, url, args...)
+		if s == nil {
+			return nil, errors.New("nng create client error")
+		}
+		return s, nil
 	} else if m == Shm {
 		return shmClient(m, url, args...)
 	}

--
Gitblit v1.8.0