Skip to content

Commit 51ba0cb

Browse files
fixed hanging infocard when position doesn't exist
fix #58
1 parent ba6f4e6 commit 51ba0cb

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
@@ -1182,13 +1182,14 @@ var mapInfoBox_handle_path = function(event) {
11821182

11831183
var mapInfoBox_handle_path_fetch = function(id,vehicle) {
11841184
$.getJSON("http://spacenear.us/tracker/datanew.php?mode=single&format=json&position_id=" + id, function(data) {
1185-
data = data.positions.position[0];
1186-
1187-
if(data.length === 0) {
1188-
box.setContent("unable to find data");
1185+
if('positions' in data && data.positions.position.length === 0) {
1186+
mapInfoBox.setContent("not found");
1187+
mapInfoBox.open(map);
11891188
return;
11901189
}
11911190

1191+
data = data.positions.position[0];
1192+
11921193
div = document.createElement('div');
11931194

11941195
html = "<div style='line-height:16px'>";

0 commit comments

Comments
 (0)