diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index d3bf61eb..4f2c226d 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -108,7 +108,7 @@ export function Sidebar({
const courseUrlRegex = /\/courses\/\d+((?:\/\d+)+)/;
if (urlRegex.test(pathName)) {
- const matchArray = pathName.match(courseUrlRegex);
+ const matchArray = pathName?.match(courseUrlRegex);
if (matchArray) {
const currentUrlContentId = Number(matchArray[1].split('/')[1]);
const pathArray = findPathToContent(
@@ -210,14 +210,16 @@ export function Sidebar({
{content.type === 'video' &&