diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index efb34f2e..49190481 100644 --- a/FrontSocket/FrontendLoop.cs +++ b/FrontSocket/FrontendLoop.cs @@ -231,6 +231,11 @@ namespace Swarmops.Frontend.Socket malfunctionsArray.Add(malfunctionObject); } + if (++_malfunctionTestCounter > 4) + { + _malfunctionTestCounter = 0; + } + JObject data2 = new JObject(); data2["MessageType"] = "Malfunctions"; data2["MalfunctionsList"] = malfunctionsArray.ToString(); diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 495a67fe..5a6af04f 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -86,9 +86,11 @@ function updateListBox(box, listData) { // Step 1: Iterate through list, build id array var idListLookup = {}; - listData.forEach(function(item, index) { - idListLookup[item.id] = item; - }); + if (listData.length > 0) { + listData.forEach(function(item, index) { + idListLookup[item.id] = item; + }); + } // Step 2: Iterate through box, change texts of matching ids, // remove items that aren't in list, build id array