From 90d8b4b5452b0562a5bd1d99107f882d840d973d Mon Sep 17 00:00:00 2001 From: Devin Bileck <603793+devinbileck@users.noreply.github.com> Date: Sat, 23 Feb 2019 23:20:59 -0800 Subject: [PATCH] Handle IllegalArgumentException in multi-screen environment When the application window is being created, it checks what the maximum bounds for a window is in order to set the window size. However, multi-screen environments may encounter an IllegalArgumentException (Window must not be zero). Just ignore the exception and continue, which means the window will use the minimum window size since we are unable to determine if we can use a larger size. Fixes https://github.com/bisq-network/bisq/issues/2452 --- desktop/src/main/java/bisq/desktop/app/BisqApp.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/desktop/src/main/java/bisq/desktop/app/BisqApp.java b/desktop/src/main/java/bisq/desktop/app/BisqApp.java index f9f37a9a87d..b4f5d24d75b 100644 --- a/desktop/src/main/java/bisq/desktop/app/BisqApp.java +++ b/desktop/src/main/java/bisq/desktop/app/BisqApp.java @@ -211,7 +211,14 @@ public void handleUncaughtException(Throwable throwable, boolean doShutDown) { /////////////////////////////////////////////////////////////////////////////////////////// private Scene createAndConfigScene(MainView mainView, Injector injector) { - Rectangle maxWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); + Rectangle maxWindowBounds = new Rectangle(); + try { + maxWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); + } catch (IllegalArgumentException e) { + // Multi-screen environments may encounter IllegalArgumentException (Window must not be zero) + // Just ignore the exception and continue, which means the window will use the minimum window size below + // since we are unable to determine if we can use a larger size + } Scene scene = new Scene(mainView.getRoot(), maxWindowBounds.width < INITIAL_WINDOW_WIDTH ? (maxWindowBounds.width < MIN_WINDOW_WIDTH ? MIN_WINDOW_WIDTH : maxWindowBounds.width) :