From c29a0bf675dc94fd350ea696d3ffa772651ff4bb Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 17 Nov 2021 10:21:42 +0100 Subject: [PATCH] Do not quit on cleanup configuration failure Cleanup is used for some options like --show-touches to restore the state on exit. If the configuration fails, do not crash the whole process. Just log an error. PR #2802 --- server/src/main/java/com/genymobile/scrcpy/Server.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index 488a877f..db5bc7ec 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -17,7 +17,7 @@ public final class Server { // not instantiable } - private static void initAndCleanUp(Options options) throws IOException { + private static void initAndCleanUp(Options options) { boolean mustDisableShowTouchesOnCleanUp = false; int restoreStayOn = -1; if (options.getShowTouches() || options.getStayAwake()) { @@ -51,7 +51,11 @@ public final class Server { } } - CleanUp.configure(options.getDisplayId(), restoreStayOn, mustDisableShowTouchesOnCleanUp, true, options.getPowerOffScreenOnClose()); + try { + CleanUp.configure(options.getDisplayId(), restoreStayOn, mustDisableShowTouchesOnCleanUp, true, options.getPowerOffScreenOnClose()); + } catch (IOException e) { + Ln.e("Could not configure cleanup", e); + } } private static void scrcpy(Options options) throws IOException {