From 062c674ef1b219a30f0635124cf03c5997b523b2 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 19 Jan 2024 10:44:06 +0100 Subject: [PATCH] Always hide spinner, as soon as locationPresetLoading is finished --- .../CreateNewVaultLocationController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java b/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java index ec9c429fa..d9f59b878 100644 --- a/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java +++ b/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java @@ -150,10 +150,13 @@ public class CreateNewVaultLocationController implements FxController { private void loadLocationPresets() { Platform.runLater(() -> loadingPresetLocations.set(true)); - LocationPresetsProvider.loadAll(LocationPresetsProvider.class) // - .flatMap(LocationPresetsProvider::getLocations) //we do not use sorted(), because it evaluates the stream elements, blocking until all elements are gathered - .forEach(this::createRadioButtonFor); - Platform.runLater(() -> loadingPresetLocations.set(false)); + try{ + LocationPresetsProvider.loadAll(LocationPresetsProvider.class) // + .flatMap(LocationPresetsProvider::getLocations) //we do not use sorted(), because it evaluates the stream elements, blocking until all elements are gathered + .forEach(this::createRadioButtonFor); + } finally { + Platform.runLater(() -> loadingPresetLocations.set(false)); + } } private void createRadioButtonFor(LocationPreset preset) {