Commit 42c6ac5
Guard bg[i] from being null in render BG graph (#15)
* Guard bg[i] from being null in render BG graph
I was getting this error during looping and it would stop the loop:
```
/root/src/openaps-menu/scripts/status.js:103
var x = 2 + zero_x + Math.round(((((bg[i].date - zerotime)/1000)/60)/5));
^
TypeError: Cannot read property 'date' of undefined
at Object.<anonymous> (/root/src/openaps-menu/scripts/status.js:103:47)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
```
This led me to believe that one of the items in the array is null, so this skips that loop iteration. After doing this the loop was running properly again.
* Update status.js1 parent cb51bef commit 42c6ac5
1 file changed
+15
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
0 commit comments