From caf9d97d5c445fa459b777c5569625bbfd0ff5fc Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 07 五月 2020 09:29:53 +0800
Subject: [PATCH] 2020-05-07-1

---
 ZigbeeApp/Shared/Phone/Device/Logic/Method.cs |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
index c484111..cb77e0c 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
@@ -766,11 +766,18 @@
 
             if (Config.Instance.Home.IsVirtually)
             {
+                if (Common.Logic.LogicList.Count == 0)
+                {
+                    CurrentLogic.LogicId = 1;
+                    Common.Logic.LogicList.Add(CurrentLogic);
+                }
+
                 if (CurrentLogic.LogicId == 0)
                 {
                     bool d = false;
                     for (int i = 1; i < 50; i++)
                     {
+                       
                         for (int j = 0; j < Common.Logic.LogicList.Count; j++)
                         {
                             if (i != Common.Logic.LogicList[j].LogicId)
@@ -792,7 +799,7 @@
                 {
                     for (int j = 0; j < Common.Logic.LogicList.Count; j++)
                     {
-                        if (j == Common.Logic.LogicList[j].LogicId)
+                        if (CurrentLogic.LogicId == Common.Logic.LogicList[j].LogicId)
                         {
                             Common.Logic.LogicList.RemoveAt(j);
                             Common.Logic.LogicList.Insert(j,CurrentLogic);

--
Gitblit v1.8.0