From dcb01752869456fecbee0ec0a5a0dcb8d3c39a4b Mon Sep 17 00:00:00 2001
From: 沈斌 <bluelazysb@hotmail.com>
Date: Sun, 25 Dec 2016 21:38:27 +0800
Subject: [PATCH] bugfix

---
 method.js |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/method.js b/method.js
index 7ba59d9..a215c48 100644
--- a/method.js
+++ b/method.js
@@ -359,13 +359,15 @@
             if(notice == null) {
                 var userID = doc.userID;
                 db.collection("users").find({"_id": userID}).limit(1).next(function(err, user){
-                    global.configs[mac] = {
-                        address: address,
-                        location: location,
-                        notice: {
-                            tel: user.username,
-                            email: user.email,
-                            open_id: user.open_id
+                    if(user) {
+                        global.configs[mac] = {
+                            address: address,
+                            location: location,
+                            notice: {
+                                tel: user.username,
+                                email: user.email,
+                                open_id: user.open_id
+                            }
                         }
                     }
                 });

--
Gitblit v1.8.0