Skip to content

Commit b1b90e0

Browse files
authored
fix: 禁止取消未生效 (#5600)
1 parent 7637009 commit b1b90e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.jackhuang.hmcl.util.i18n.I18n;
3232
import org.jetbrains.annotations.NotNull;
3333

34-
import java.util.Optional;
3534
import java.util.function.Consumer;
3635

3736
import static org.jackhuang.hmcl.ui.FXUtils.onEscPressed;
@@ -83,8 +82,9 @@ public TaskExecutorDialogPane(@NotNull TaskCancellationAction cancel) {
8382
setCancel(cancel);
8483

8584
btnCancel.setOnAction(e -> {
86-
Optional.ofNullable(executor).ifPresent(TaskExecutor::cancel);
8785
if (onCancel.getCancellationAction() != null) {
86+
if (executor != null)
87+
executor.cancel();
8888
onCancel.getCancellationAction().accept(this);
8989
}
9090
});

0 commit comments

Comments
 (0)