Skip to content

Commit

Permalink
Fix panic due to nil calendar config. (#18065)
Browse files Browse the repository at this point in the history
#18063

Fixing potential server panic when events are created with calendar
integration, but then global calendar integration is disabled.

Could not do a PR directly from
[fleet-v4.48.0](https://github.com/fleetdm/fleet/releases/tag/fleet-v4.48.0)
due to merge conflicts.

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Added/updated tests
- [x] Manual QA for all new/changed functionality
  • Loading branch information
getvictor authored and georgekarrv committed Apr 8, 2024
1 parent 49530e2 commit b78f101
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/18065-calendar-config-panic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixing potential server panic when events are created with calendar integration, but then global calendar integration is disabled.
5 changes: 4 additions & 1 deletion cmd/fleet/calendar_cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,10 @@ func deleteCalendarEventsInParallel(
go func() {
defer wg.Done()
for calEvent := range calendarEventCh {
userCalendar := createUserCalendarFromConfig(ctx, calendarConfig, logger)
var userCalendar fleet.UserCalendar
if calendarConfig != nil {
userCalendar = createUserCalendarFromConfig(ctx, calendarConfig, logger)
}
if err := deleteCalendarEvent(ctx, ds, userCalendar, calEvent); err != nil {
level.Error(logger).Log("msg", "delete user calendar event", "err", err)
continue
Expand Down

0 comments on commit b78f101

Please sign in to comment.