fix: never let totalNotes go below 0

This commit is contained in:
thecodrr
2020-01-06 18:07:17 +05:00
parent 238d40eabf
commit 34a1315c92

View File

@@ -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;
}
);