Skip to content

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

fix: crash when adding notebook without topics

thecodrrb942b61fbff3
diff --git a/packages/core/api/database.js b/packages/core/api/database.js
index 4b9683808..60d44257e 100644
--- a/packages/core/api/database.js
+++ b/packages/core/api/database.js
@@ -253,7 +253,7 @@ class Database {
const id = notebook.dateCreated || Date.now();
let topics =
!notebook.topics || notebook.topics.length <= 0 ? [] : notebook.topics; //
- if (notebook.topics.findIndex(topic => topic.title === "General") <= -1) {
+ if (topics.findIndex(topic => topic.title === "General") <= -1) {
topics.splice(0, 0, makeTopic("General"));
}
let index = 0;