diff --git a/wash/src/wash/control/Wash.java b/wash/src/wash/control/Wash.java index 0f0f4bf..5755321 100644 --- a/wash/src/wash/control/Wash.java +++ b/wash/src/wash/control/Wash.java @@ -32,7 +32,7 @@ public class Wash { // if the user presses button 0, and a program has been started, stop it switch (n) { - case 0 -> t = new WashingProgramStop(io, temp, water, spin); + case 0 -> t.interrupt(); case 1 -> t = new WashingProgram1(io, temp, water, spin); case 2 -> t = new WashingProgram2(io, temp, water, spin); case 3 -> t = new WashingProgram3(io, temp, water, spin); @@ -42,7 +42,8 @@ public class Wash { } } - t.start(); + if (!t.isInterrupted()) + t.start(); } temp.interrupt();