diff --git a/src/components/NavigationBarSingleList.jsx b/src/components/NavigationBarSingleList.jsx index 3177cb0..e298ed8 100644 --- a/src/components/NavigationBarSingleList.jsx +++ b/src/components/NavigationBarSingleList.jsx @@ -22,16 +22,19 @@ export function NavigationBarSingleList({ window.location.pathname.substring( window.location.pathname.lastIndexOf('/') + 1, ) === 'list'; - const localStorageListName = localStorage - .getItem('tcl-shopping-list-path') - .substring( - localStorage.getItem('tcl-shopping-list-path').lastIndexOf('/') + 1, - ); + + const localStorageListName = + localStorage + ?.getItem('tcl-shopping-list-path') + ?.substring( + localStorage.getItem('tcl-shopping-list-path').lastIndexOf('/') + 1, + ) || ''; return (