From 03cd9c22eaba32ae01adfc486416f8367e2370c9 Mon Sep 17 00:00:00 2001 From: bb4L <39266013+bb4L@users.noreply.github.com> Date: Sun, 4 Jul 2021 20:18:30 +0200 Subject: [PATCH] Fix mutex issue when adding a alarm --- storage/alarm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/alarm.go b/storage/alarm.go index 116d88c..2d33412 100644 --- a/storage/alarm.go +++ b/storage/alarm.go @@ -57,10 +57,10 @@ func (storageHelper *Helper) GetAlarm(idx int, withWritePermission bool) (types. // AddAlarm adds a given alarm func (storageHelper *Helper) AddAlarm(alarm types.Alarm) ([]types.Alarm, error) { storageHelper.getMutex().Lock() - defer storageHelper.getMutex().Unlock() data, err := storageHelper.getStoredData() if err != nil { + storageHelper.getMutex().Unlock() return []types.Alarm{}, err }