Add a null check when modifying the documentation link

This prevents a runtime error from appearing in the console.
This commit is contained in:
Hugo Locurcio
2020-03-23 22:34:03 +01:00
parent 9e991a89d0
commit 9e2263164f

View File

@@ -29,9 +29,15 @@
document.querySelectorAll('td:last-child').forEach(td => { document.querySelectorAll('td:last-child').forEach(td => {
const docLink = td.querySelector('a'); const docLink = td.querySelector('a');
// Only keep the last fragment and trim the file extension to make the table less wide. if (docLink) {
const docLinkSplit = docLink.innerText.split('/'); // Only keep the last fragment and trim the file extension to make the table less wide.
docLink.innerText = docLinkSplit[docLinkSplit.length - 1].slice(0, -5); const docLinkSplit = docLink.innerText.split('/');
const finalText = docLinkSplit[docLinkSplit.length - 1].slice(0, -5);
if (finalText.length >= 1) {
// Don't override the Overall link as it's short enough to be displayed in full.
docLink.innerText = finalText;
}
}
}); });
</script> </script>
</body> </body>