diff --git a/frontend/main.ts b/frontend/main.ts index 6e9f387..5a4d8ff 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -132,13 +132,21 @@ function setMaxAmountRowers(name: string, rowers: number) { let shipmaster = document.querySelector('#shipmaster-newrowerjs'); let steering_person = document.querySelector('#steering_person-newrowerjs'); if (rowers == 1){ - shipmaster.parentNode.classList.add('hidden'); - steering_person.parentNode.classList.add('hidden'); + if (shipmaster.parentNode) { + (shipmaster.parentNode).classList.add('hidden'); + } + if (steering_person.parentNode){ + (steering_person.parentNode).classList.add('hidden'); + } }else{ - shipmaster.parentNode.classList.remove('hidden'); + if (shipmaster.parentNode){ + (shipmaster.parentNode).classList.remove('hidden'); + } shipmaster.setAttribute('required', 'required'); - steering_person.parentNode.classList.remove('hidden'); + if (steering_person.parentNode){ + (steering_person.parentNode).classList.remove('hidden'); + } steering_person.setAttribute('required', 'required'); } }