From 0c5472043e6da6dd4e0ad59318ccfca3534c0234 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Wed, 22 Mar 2017 22:29:02 +0000 Subject: [PATCH] Don't explode on map pan after deselecting an aircraft that was being followed. --- public_html/script.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public_html/script.js b/public_html/script.js index bc3fcbb..b505293 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -580,8 +580,9 @@ function initialize_map() { if (FollowSelected) { // On manual navigation, disable follow var selected = Planes[SelectedPlane]; - if (Math.abs(center[0] - selected.position[0]) > 0.0001 && - Math.abs(center[1] - selected.position[1]) > 0.0001) { + if (typeof selected === 'undefined' || + (Math.abs(center[0] - selected.position[0]) > 0.0001 && + Math.abs(center[1] - selected.position[1]) > 0.0001)) { FollowSelected = false; refreshSelected(); refreshHighlighted();