diff --git a/tabs/mission_control.js b/tabs/mission_control.js index 2161416c7..c4454eec7 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -3224,8 +3224,8 @@ TABS.mission_control.initialize = function (callback) { }); $('#safehomeLatitude').on('change', event => { - if (selectedFwApproachSh) { - selectedFwApproachSh.setLat(Math.round(Number($(event.currentTarget).val()) * 1e7)); + if (selectedSafehome && selectedFwApproachSh) { + selectedSafehome.setLat(Math.round(Number($(event.currentTarget).val()) * 1e7)); renderSafeHomeOptions(); cleanSafehomeLayers(); renderSafehomesOnMap(); @@ -3234,8 +3234,8 @@ TABS.mission_control.initialize = function (callback) { $('#safehomeLongitude').on('change', event => { - if (selectedFwApproachSh) { - selectedFwApproachSh.setLon(Math.round(Number($(event.currentTarget).val()) * 1e7)); + if (selectedSafehome && selectedFwApproachSh) { + selectedSafehome.setLon(Math.round(Number($(event.currentTarget).val()) * 1e7)); renderSafeHomeOptions(); cleanSafehomeLayers(); renderSafehomesOnMap();