Skip to content

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

mobile: add missing null check

ammarahm-ed058431836d1e
diff --git a/apps/mobile/app/utils/index.js b/apps/mobile/app/utils/index.js
index 91ce93781..ee39d942f 100755
--- a/apps/mobile/app/utils/index.js
+++ b/apps/mobile/app/utils/index.js
@@ -130,10 +130,12 @@ export function setWidthHeight(size) {
export function getTotalNotes(item) {
if (!item || item.type === "header") return 0;
if (item.type === "topic") {
- return db.notebooks.notebook(item.notebookId)?.topics.topic(item.id)
- .totalNotes;
+ return (
+ db.notebooks.notebook(item.notebookId)?.topics.topic(item.id)
+ ?.totalNotes || 0
+ );
}
- return db.notebooks.notebook(item.id)?.totalNotes;
+ return db.notebooks.notebook(item.id)?.totalNotes || 0;
}
export async function toTXT(note, notitle) {