fix: Cannot read property 'topics' of undefined

This commit is contained in:
thecodrr
2021-02-25 10:55:46 +05:00
parent b38d0b2253
commit 7930fdb5dd

View File

@@ -63,8 +63,10 @@ export function notesFromContext(context) {
notes = db.notes.colored(context.value);
break;
case "topic":
const notebook = db.notebooks.notebook(context.value.id);
const topic = notebook.topics.topic(context.value.topic);
const notebook = db.notebooks.notebook(context?.value?.id);
if (!notebook) break;
const topic = notebook.topics?.topic(context?.value?.topic);
if (!topic) break;
notes = topic.all;
break;
case "favorite":