Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: crash if notebook topic is undefined

thecodrr838f29b9be33
diff --git a/apps/web/src/components/properties/index.js b/apps/web/src/components/properties/index.js
index 2bcde0cde..35754adbd 100644
--- a/apps/web/src/components/properties/index.js
+++ b/apps/web/src/components/properties/index.js
@@ -151,9 +151,13 @@ function Properties() {
{notebooks.map((ref) => {
const notebook = db.notebooks.notebook(ref.id);
if (!notebook) return null;
- const topics = ref.topics.map(
- (topicId) => notebook.topics.topic(topicId)._topic
- );
+ const topics = ref.topics.reduce((topics, topicId) => {
+ const topic = notebook.topics.topic(topicId);
+ if (!!topic && !!topic._topic)
+ topics.push(topic._topic);
+ return topics;
+ }, []);
+
return (
<Flex flexDirection="column" my={1}>
<Flex