Skip to content

Commit

Permalink
Check for null attendees on event.
Browse files Browse the repository at this point in the history
  • Loading branch information
phw198 committed Feb 28, 2021
1 parent 4a1fe3f commit fbaada1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ public Event UpdateCalendarEntry(AppointmentItem ai, Event ev, ref int itemModif
"more than 200, which Google does not allow.", Console.Markup.warning);
}
} else if (Settings.Instance.SyncDirection == Sync.Direction.Bidirectional &&
ev.Attendees.Count > Settings.Instance.MaxAttendees && ai.Recipients.Count <= Settings.Instance.MaxAttendees) {
ev.Attendees != null && ev.Attendees.Count > Settings.Instance.MaxAttendees && ai.Recipients.Count <= Settings.Instance.MaxAttendees) {
log.Warn("This Google event has " + ev.Attendees.Count + " attendees, more than the user configured maximum. They can't safely be compared.");
} else {
try {
Expand Down
6 changes: 3 additions & 3 deletions src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private void createCalendarEntry(Event ev, ref AppointmentItem ai) {
ai.Categories = getColour(ev.ColorId, null);

if (Settings.Instance.AddAttendees && ev.Attendees != null) {
if (ev.Attendees.Count > Settings.Instance.MaxAttendees) {
if (ev.Attendees != null && ev.Attendees.Count > Settings.Instance.MaxAttendees) {
log.Warn("This Google event has " + ev.Attendees.Count + " attendees, more than the user configured maximum.");
} else {
foreach (EventAttendee ea in ev.Attendees) {
Expand Down Expand Up @@ -556,10 +556,10 @@ public Boolean UpdateCalendarEntry(ref AppointmentItem ai, Event ev, ref int ite
}

if (Settings.Instance.AddAttendees) {
if (ev.Attendees.Count > Settings.Instance.MaxAttendees) {
if (ev.Attendees != null && ev.Attendees.Count > Settings.Instance.MaxAttendees) {
log.Warn("This Google event has " + ev.Attendees.Count + " attendees, more than the user configured maximum.");
} else if (Settings.Instance.SyncDirection == Sync.Direction.Bidirectional &&
ai.Recipients.Count > Settings.Instance.MaxAttendees && ev.Attendees.Count <= Settings.Instance.MaxAttendees) {
ai.Recipients.Count > Settings.Instance.MaxAttendees && (ev.Attendees == null ? 0 : ev.Attendees.Count) <= Settings.Instance.MaxAttendees) {
log.Warn("This Outlook appointment has " + ai.Recipients.Count + " attendees, more than the user configured maximum. They can't safely be compared.");
} else {
log.Fine("Comparing meeting attendees");
Expand Down

0 comments on commit fbaada1

Please sign in to comment.