Skip to content

Commit

Permalink
fix null deref in trackUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Feb 2, 2021
1 parent a1375ed commit df4067e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions html/planeObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,18 @@ PlaneObject.prototype.updateTrack = function(now, last, serverTrack, stale) {
return this.updateTail();
}

if (!this.prev_position)
let lastseg = this.track_linesegs[this.track_linesegs.length - 1];

if (!this.prev_position) {
return this.updateTail();
}

let projPrev = ol.proj.fromLonLat(this.prev_position);
let lastseg = this.track_linesegs[this.track_linesegs.length - 1];

if (!this.tail_position) {
lastseg.fixed.appendCoordinate(projPrev);
return this.updateTail();
}

let distance = ol.sphere.getDistance(this.position, this.prev_position);
let elapsed = this.position_time - this.prev_time;
Expand Down

0 comments on commit df4067e

Please sign in to comment.