sfsam / Itsycal

Itsycal is a tiny calendar for your Mac's menu bar. http://www.mowglii.com/itsycal
MIT License
3.25k stars 234 forks source link

The event details popup does not appear if the attendee does not have a name. #239

Closed kdovbush closed 5 months ago

kdovbush commented 5 months ago

Description:

If an event has attendees, and one of them doesn't have a name field, then the event details popup won't appear after clicking on the event cell.

Environment:

Steps to reproduce:

  1. Add an event with a list of attendees and ensure that one of them doesn't have a name field (mine is from Microsoft Teams calendar, and the attendee has only an email).
  2. Click on the event cell to show the details popup.

Expected behaviour:

The event details popup appears.

Actual behavior:

Nothing happens, but an assertion failure occurs in AgendaViewController.m:1184.

*** Assertion failure in +[NSTextField labelWithString:], NSTextField.m:1 751
Invalid parameter not satisfying: stringValue != nil
    0   CoreFoundation                      0x00007ff80220e0b6 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007ff801d03231 objc_exception_throw + 48
    2   Foundation                          0x00007ff8031f3766 -[NSCalendarDate initWithCoder:] + 0
    3   AppKit                              0x00007ff80596b0e0 +[NSTextField(NSTextFieldConvenience) labelWithString:] + 302
    4   Itsycal                             0x0000000101f8a453 -[AgendaPopoverVC populateWithEventInfo:] + 11027
    5   Itsycal                             0x0000000101f7f9e7 -[AgendaViewController showPopover:] + 663

Possible solution:

It turns out that the name property in EKParticipant is nullable. Therefore, I believe it would be better to check if it's nil and, if so, use an alternative (for example, an email).

sfsam commented 5 months ago

Thanks for the report. I'm kind of flying blind when it comes to attendees since I don't work with any kind of collaboration software and can't really generate good test cases. Indeed, the code was simply using EKParticipant name. I've changed it to check for nil and fall back to EKParticipant URL.resourceSpecifier (email) or just a dummy string if that too is nil.

Can you check if this works?... https://itsycal.s3.amazonaws.com/Itsycal-0.15.2-issue-239-1.zip

kdovbush commented 5 months ago

Thanks for the quick response!

I have checked your fix and now everything works as expected.