From ccb8888df2537966d68c6c7caf6f213ea4e7fad9 Mon Sep 17 00:00:00 2001 From: crschnick Date: Fri, 13 Sep 2024 18:30:10 +0000 Subject: [PATCH] Fix some exceptions --- .../app/browser/file/BrowserFileListComp.java | 3 ++- .../main/java/io/xpipe/app/util/LocalShell.java | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java index 45b9ceae4..9eaba89c9 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java @@ -502,7 +502,8 @@ public final class BrowserFileListComp extends SimpleComp { updateHandler.run(); fileList.getShown().addListener((observable, oldValue, newValue) -> { - updateHandler.run(); + // Delay to prevent internal tableview exceptions when sorting + Platform.runLater(updateHandler); }); fileList.getFileSystemModel().getCurrentPath().addListener((observable, oldValue, newValue) -> { if (oldValue == null) { diff --git a/app/src/main/java/io/xpipe/app/util/LocalShell.java b/app/src/main/java/io/xpipe/app/util/LocalShell.java index bea8ff57c..93604db8f 100644 --- a/app/src/main/java/io/xpipe/app/util/LocalShell.java +++ b/app/src/main/java/io/xpipe/app/util/LocalShell.java @@ -1,6 +1,7 @@ package io.xpipe.app.util; import io.xpipe.app.ext.ProcessControlProvider; +import io.xpipe.core.process.ProcessOutputException; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellDialects; @@ -38,11 +39,15 @@ public class LocalShell { } if (localPowershell == null) { - localPowershell = ProcessControlProvider.get() - .createLocalProcessControl(false) - .subShell(ShellDialects.POWERSHELL) - .withoutLicenseCheck() - .start(); + try { + localPowershell = ProcessControlProvider.get() + .createLocalProcessControl(false) + .subShell(ShellDialects.POWERSHELL) + .withoutLicenseCheck() + .start(); + } catch (ProcessOutputException ex) { + throw ProcessOutputException.withPrefix("Failed to start local powershell process", ex); + } } return localPowershell.start(); }