1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-11-28 18:11:07 +02:00

Fix language selector on unpublished languages (#695)

The Danish translation is not yet linked in the language selector
since it is very incomplete. This means that `selectedLang` is `null`
in this case and thus we should not call any methods on it.
This commit is contained in:
Martin Geisler 2023-05-26 16:23:57 +02:00 committed by GitHub
parent 7739b4925a
commit 66247b698e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -172,7 +172,9 @@
langList.style.display = langList.style.display == "block" ? "none" : "block";
});
let selectedLang = document.getElementById("{{ language }}");
selectedLang.parentNode.classList.add("theme-selected");
if (selectedLang) {
selectedLang.parentNode.classList.add("theme-selected");
}
// The path to the root, taking the current
// language into account.