Skip to content

Commit 0865f16

Browse files
committed
Fix some possible exceptions in websage.js.
1 parent f48cd6b commit 0865f16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/htdocs/websage.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3520,6 +3520,7 @@ getHistoricalData: function (i, pnt, timeBegin) {
35203520
WebSAGE.Pass++;
35213521

35223522
var prop;
3523+
if (data.Body.Results)
35233524
data.Body.Results.map(element => {
35243525
if (typeof element.StatusCode == "number" && element.StatusCode != 0) // reject a bad result
35253526
return;
@@ -5620,7 +5621,7 @@ getHistoricalData: function (i, pnt, timeBegin) {
56205621

56215622
// execute scripts in the svg file
56225623
( async function() {
5623-
var scripts = SVGDoc.getElementsByTagName("script");
5624+
var scripts = SVGDoc?.getElementsByTagName("script")||[];
56245625
var importPergola = -1;
56255626
for (var i = 0; i < scripts.length; i++) {
56265627
if (scripts[i].href.baseVal.endsWith("pergola.js")) {
@@ -6219,6 +6220,7 @@ getHistoricalData: function (i, pnt, timeBegin) {
62196220
WebSAGE.g_toutID = setTimeout(WebSAGE.callServer, 10);
62206221

62216222
// Mouse wheel event to zoom in/out graphics
6223+
if (SVGDoc)
62226224
SVGDoc.addEventListener(
62236225
"wheel",
62246226
function(event) {

0 commit comments

Comments
 (0)