Can't pop the last mode
authorTomas Wenström <tomas.wenstrom@gmail.com>
Mon, 2 Dec 2019 22:06:57 +0000 (23:06 +0100)
committerTomas Wenström <tomas.wenstrom@gmail.com>
Mon, 2 Dec 2019 22:06:57 +0000 (23:06 +0100)
src/kaka/cakelight/CakeLight.java

index cd59362..2f77a14 100644 (file)
@@ -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;