From e073819868785dd5e1980d2218cea58481be4ce4 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Tue, 21 Jul 2020 20:33:40 -0700 Subject: [PATCH] html/girocco.js: avoid unwanted exception Check to make sure the radio button elements are actually present before attempting to manipulate them. Signed-off-by: Kyle J. McKay --- html/girocco.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/html/girocco.js b/html/girocco.js index 93fc43f..8b6bfe1 100644 --- a/html/girocco.js +++ b/html/girocco.js @@ -42,12 +42,15 @@ function set_mirror_source(which) { } } window.addEvent('domready', function() { - mirror_push_prepare(document.getElementById('mirror_radio'), - document.getElementById('push_radio')); - if (document.getElementById('mirror_radio').checked) { - mirror_push__click(null, 'mirror') - } - if (document.getElementById('push_radio').checked) { - mirror_push__click(null, 'push') + var mr = document.getElementById('mirror_radio'); + var pr = document.getElementById('push_radio'); + if (mr && pr) { + mirror_push_prepare(mr, pr); + if (mr.checked) { + mirror_push__click(null, 'mirror') + } + if (pr.checked) { + mirror_push__click(null, 'push') + } } }); -- 2.11.4.GIT