File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -193,16 +193,20 @@ - (void)_fetchSourcesAndCalendars {
193
193
NSMutableArray *sourcesAndCalendars = [NSMutableArray new ];
194
194
NSString *currentSourceTitle = @" " ;
195
195
for (EKCalendar *calendar in calendars) {
196
+ NSString *calendarSourceTitle = calendar.source .title ;
197
+ // (!) Should never hit this case, but MacOS 13 sometimes returns
198
+ // nil for non-iCloud source titles. Use a dummy title instead.
199
+ if (!calendar.source .title ) calendarSourceTitle = @" ???" ;
196
200
if (!calendar.color ) {
197
201
// Skip calendars where the color is nil.
198
202
// This normally doesn't happen, but there are some
199
203
// edge cases where it does.
200
204
// See: github.com/sfsam/Itsycal/issues/152
201
205
continue ;
202
206
}
203
- if (![calendar.source.title isEqualToString: currentSourceTitle]) {
204
- [sourcesAndCalendars addObject: calendar.source.title ];
205
- currentSourceTitle = calendar. source . title ;
207
+ if (![calendarSourceTitle isEqualToString: currentSourceTitle]) {
208
+ [sourcesAndCalendars addObject: calendarSourceTitle ];
209
+ currentSourceTitle = calendarSourceTitle ;
206
210
}
207
211
CalendarInfo *calInfo = [CalendarInfo new ];
208
212
calInfo.calendar = calendar;
Original file line number Diff line number Diff line change @@ -269,7 +269,8 @@ - (void)viewWillAppear
269
269
[_calPopup.menu addItem: [NSMenuItem separatorItem ]];
270
270
}
271
271
NSMenuItem *sourceItem = [NSMenuItem new ];
272
- sourceItem.title = calInfo.calendar .source .title ;
272
+ // MacOS 13 sometimes returns nil for non-iCloud source titles.
273
+ sourceItem.title = calInfo.calendar .source .title ?: @" ???" ;
273
274
sourceItem.enabled = NO ;
274
275
[_calPopup.menu addItem: sourceItem];
275
276
currentSource = calInfo.calendar .source ;
You can’t perform that action at this time.
0 commit comments