Skip to content

Build your personal knowledge base with Trilium Notes

fix: 🐛 fix crash when no calendarRoot

Jinf346c40b7c34
diff --git a/src/public/app/widgets/buttons/calendar.ts b/src/public/app/widgets/buttons/calendar.ts
index ddfccbdd55..a8b2d45422 100644
--- a/src/public/app/widgets/buttons/calendar.ts
+++ b/src/public/app/widgets/buttons/calendar.ts
@@ -213,6 +213,10 @@ export default class CalendarWidget extends RightDropdownButtonWidget {
private async getWeekNoteEnable() {
const noteId = await server.get<string[]>(`search/${encodeURIComponent('#calendarRoot')}`);
+ if (noteId.length === 0) {
+ this.weekNoteEnable = false;
+ return;
+ }
const noteAttributes = await server.get<BAttribute[]>(`notes/${noteId}/attributes`);
for (const attribute of noteAttributes) {