diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java index f2a4e9ff7d..6f198f6842 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java @@ -81,12 +81,11 @@ public class TaskExecutorDialogPane extends BorderPane { setCancel(cancel); + btnCancel.setDisable(onCancel.getCancellationAction() == null); btnCancel.setOnAction(e -> { - if (onCancel.getCancellationAction() != null) { - if (executor != null) - executor.cancel(); - onCancel.getCancellationAction().accept(this); - } + if (executor != null) + executor.cancel(); + onCancel.getCancellationAction().accept(this); }); speedEventHandler = FetchTask.SPEED_EVENT.registerWeak(speedEvent -> {