Skip to content

Commit 74e2502

Browse files
committed
check is defined
1 parent d02f537 commit 74e2502

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

js/tracker.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,10 +2212,12 @@ function addPosition(position) {
22122212
var curr_ts = convert_time(vehicle.curr_position.gps_time);
22132213
var dt = (new_ts - curr_ts) / 1000; // convert to seconds
22142214

2215-
if (position.type.length < vehicle.curr_position.type) {
2216-
position.type.length = vehicle.curr_position.type;
2215+
if (typeof position.type !== 'undefined' && typeof vehicle.curr_position.type !== 'undefined') {
2216+
if (position.type.length < vehicle.curr_position.type.length) {
2217+
position.type = vehicle.curr_position.type;
2218+
}
22172219
}
2218-
2220+
22192221
if(dt >= 0) {
22202222
if(vehicle.num_positions > 0) {
22212223
// calculate vertical rate

0 commit comments

Comments
 (0)