From: Tomas Wenström Date: Mon, 2 Dec 2019 22:06:57 +0000 (+0100) Subject: Can't pop the last mode X-Git-Url: http://www.dolda2000.com/gitweb/?p=kaka%2Fcakelight.git;a=commitdiff_plain;h=5552e9bd6fc5bd9d23642721e763ccb812a0f1c4 Can't pop the last mode --- diff --git a/src/kaka/cakelight/CakeLight.java b/src/kaka/cakelight/CakeLight.java index cd59362..2f77a14 100644 --- a/src/kaka/cakelight/CakeLight.java +++ b/src/kaka/cakelight/CakeLight.java @@ -42,12 +42,10 @@ public class CakeLight { } public Mode popMode() { - if (!modes.isEmpty()) { + if (modes.size() > 1) { Mode mode = modes.pop(); stopMode(mode); - if (!modes.isEmpty()) { - resumeMode(modes.peek()); - } + resumeMode(modes.peek()); return mode; } return null;