From 54e0a86240c9e99e45257022ad05ad8db5eb83f5 Mon Sep 17 00:00:00 2001 From: Zdenek Devaty Date: Tue, 11 Jun 2024 20:59:00 +0200 Subject: [PATCH] Fix panic Two silly mistakes caused it. --- app.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index db66e45..e1b661b 100644 --- a/app.go +++ b/app.go @@ -341,6 +341,7 @@ func listenForBookings(config apiserver.Configuration) { log.Error("eliona-bookings", "listening for booking changes: %v", err) return } +outer: for group := range bookingsChan { if len(group.Occurrences) == 1 && group.Occurrences[0].Cancelled { // Typical case, just a single booking. Cancel the RecurringMaster/group. @@ -351,7 +352,7 @@ func listenForBookings(config apiserver.Configuration) { if occurrence.Cancelled { // We must handle cancellation differently to cancel just single occurrences. cancelOccurrenceInEWS(group, occurrence, config) - continue + continue outer } } bookInEWS(group, config) @@ -418,6 +419,7 @@ func bookInEWS(group syncmodel.BookingGroup, config apiserver.Configuration) { defer mu.Unlock() if len(group.Occurrences) != 1 { log.Error("booking", "booking %d != 1 occurences of a group ElionaID %d is not supported", len(group.Occurrences), group.ElionaID) + return } book := group.Occurrences[0] assets, err := conf.GetAssetEmailsByIds(book.GetAssetIDs())