From 9e6cf2f2f15b3fef1f99a2fcf980eb96945dc936 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sat, 21 Mar 2015 12:33:58 +0100 Subject: Cannot delete a timer if it is the last one --- src/Update/Update.elm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Update') diff --git a/src/Update/Update.elm b/src/Update/Update.elm index c6c5f32..2cb45cb 100644 --- a/src/Update/Update.elm +++ b/src/Update/Update.elm @@ -76,7 +76,11 @@ update action model = Nothing -> { model | timers <- Dict.update id (Maybe.map (updateTimer action)) model.timers } RemoveTimer id -> - { model | timers <- Dict.remove id model.timers } + if numberOfTimers model > 1 + then + { model | timers <- Dict.remove id model.timers } + else + model EditTimer id -> { model | timerEdition <- Just (newTimerEdition id) -- cgit v1.2.3