SVGHMI: explicit handling of undefined maximum widget update frequency svghmi
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Wed, 13 May 2020 18:47:09 +0200
branchsvghmi
changeset 2960 5ad82541b46e
parent 2959 ae549ba1a116
child 2961 00825316ed00
SVGHMI: explicit handling of undefined maximum widget update frequency
svghmi/svghmi.js
--- a/svghmi/svghmi.js	Wed May 13 18:27:26 2020 +0200
+++ b/svghmi/svghmi.js	Wed May 13 18:47:09 2020 +0200
@@ -207,9 +207,11 @@
         let new_period = 0;
         if(widgets.size > 0) {
             let maxfreq = 0;
-            for(let widget of widgets)
-                if(maxfreq < widget.frequency)
-                    maxfreq = widget.frequency;
+            for(let widget of widgets){
+                let wf = widget.frequency;
+                if(wf != undefined && maxfreq < wf)
+                    maxfreq = wf;
+            }
 
             if(maxfreq != 0)
                 new_period = 1000/maxfreq;