Skip to content

Commit 81bede8

Browse files
the data field is no longer a string
1 parent 5335a07 commit 81bede8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

js/tracker.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,13 +555,14 @@ function habitat_data(jsondata, alternative) {
555555

556556
try
557557
{
558-
if (jsondata === undefined || jsondata === "")
559-
return "";
558+
if (jsondata === undefined || jsondata === null) return "";
560559

561-
var data = $.parseJSON(jsondata);
560+
var data = (typeof jsondata === "string") ? $.parseJSON(jsondata) : jsondata;
562561
var array = [];
563562
var output = "";
564563

564+
if(Object.keys(data).length === 0) return "";
565+
565566
for(var key in data) {
566567
array.push([key, data[key]]);
567568
}
@@ -1982,7 +1983,7 @@ function graphAddPosition(vcallsign, new_data) {
19821983
if(plot && new_data.data !== "") {
19831984

19841985
// the rest of the series is from the data field
1985-
var json = $.parseJSON(new_data.data);
1986+
var json = (typeof new_data.data === "string") ? $.parseJSON(new_data.data) : new_data.data;
19861987

19871988
// init empty data matrix
19881989
var data_matrix = [];

0 commit comments

Comments
 (0)