validate footer element exists before applying style

Signed-off-by: Colton Padden <colton.padden@fastmail.com>
This commit is contained in:
Colton Padden
2021-12-30 11:40:18 -05:00
parent e0271456d8
commit fb36de6138
@@ -171,7 +171,9 @@ export const useTechDocsReaderDom = (entityRef: EntityName): Element | null => {
const updateFooterWidth = useCallback(() => {
if (!dom) return;
const footer = dom.querySelector('.md-footer') as HTMLElement;
footer.style.width = `${dom.getBoundingClientRect().width}px`;
if (footer) {
footer.style.width = `${dom.getBoundingClientRect().width}px`;
}
}, [dom]);
useEffect(() => {