From 2f0ea48a314894b5306e8df0644a3322c479372b Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 25 May 2024 10:51:00 -0400 Subject: [PATCH] fix jfx error in MainView --- .../java/haveno/desktop/main/MainView.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/desktop/src/main/java/haveno/desktop/main/MainView.java b/desktop/src/main/java/haveno/desktop/main/MainView.java index 830c8517e5..2a78feb6cf 100644 --- a/desktop/src/main/java/haveno/desktop/main/MainView.java +++ b/desktop/src/main/java/haveno/desktop/main/MainView.java @@ -352,23 +352,24 @@ public class MainView extends InitializableView { settingsButtonWithBadge.getStyleClass().add("new"); navigation.addListener((viewPath, data) -> { - if (viewPath.size() != 2 || viewPath.indexOf(MainView.class) != 0) - return; + UserThread.execute(() -> { + if (viewPath.size() != 2 || viewPath.indexOf(MainView.class) != 0) return; - Class viewClass = viewPath.tip(); - View view = viewLoader.load(viewClass); - contentContainer.getChildren().setAll(view.getRoot()); + Class viewClass = viewPath.tip(); + View view = viewLoader.load(viewClass); + contentContainer.getChildren().setAll(view.getRoot()); - try { - navButtons.getToggles().stream() - .filter(toggle -> toggle instanceof NavButton) - .filter(button -> viewClass == ((NavButton) button).viewClass) - .findFirst() - .orElseThrow(() -> new HavenoException("No button matching %s found", viewClass)) - .setSelected(true); - } catch (HavenoException e) { - navigation.navigateTo(MainView.class, MarketView.class, OfferBookChartView.class); - } + try { + navButtons.getToggles().stream() + .filter(toggle -> toggle instanceof NavButton) + .filter(button -> viewClass == ((NavButton) button).viewClass) + .findFirst() + .orElseThrow(() -> new HavenoException("No button matching %s found", viewClass)) + .setSelected(true); + } catch (HavenoException e) { + navigation.navigateTo(MainView.class, MarketView.class, OfferBookChartView.class); + } + }); }); VBox splashScreen = createSplashScreen();