fix: 🐛 fix crash when no calendarRoot

This commit is contained in:
Jin 2025-04-08 14:00:42 +02:00
parent a4f59030e3
commit f346c40b7c

View File

@ -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) {