Skip to content

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

fix: never let totalNotes go below 0

thecodrr34a1315c928d
diff --git a/packages/core/api/database.js b/packages/core/api/database.js
index 204e24347..edb60d190 100644
--- a/packages/core/api/database.js
+++ b/packages/core/api/database.js
@@ -339,8 +339,9 @@ class Database {
//delete notebook from note
this.notes[noteId].notebook = {};
//decrement totalNotes count
- notebook.topics[topicIndex].totalNotes--;
- notebook.totalNotes--;
+ if (notebook.topics[topicIndex].totalNotes > 0)
+ notebook.topics[topicIndex].totalNotes--;
+ if (notebook.totalNotes > 0) notebook.totalNotes--;
return true;
}
);