From b60c3d1bba56afb2f6a178441124b4e27c263637 Mon Sep 17 00:00:00 2001 From: crschnick Date: Tue, 25 Apr 2023 10:58:03 +0000 Subject: [PATCH] Fix NPE [release] [noannounce] --- .../java/io/xpipe/app/browser/FileListComp.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/FileListComp.java b/app/src/main/java/io/xpipe/app/browser/FileListComp.java index d510f7fc5..f4779da23 100644 --- a/app/src/main/java/io/xpipe/app/browser/FileListComp.java +++ b/app/src/main/java/io/xpipe/app/browser/FileListComp.java @@ -251,10 +251,14 @@ final class FileListComp extends AnchorPane { var currentDirectory = fileList.getFileSystemModel().getCurrentDirectory(); if (!Objects.equals(lastDir.get(), currentDirectory)) { TableViewSkin skin = (TableViewSkin) table.getSkin(); - VirtualFlow flow = (VirtualFlow) skin.getChildren().get(1); - ScrollBar vbar = (ScrollBar) flow.getChildrenUnmodifiable().get(2); - if (vbar.getValue() != 0.0) { - table.scrollTo(0); + if (skin != null) { + VirtualFlow flow = + (VirtualFlow) skin.getChildren().get(1); + ScrollBar vbar = + (ScrollBar) flow.getChildrenUnmodifiable().get(2); + if (vbar.getValue() != 0.0) { + table.scrollTo(0); + } } } lastDir.setValue(currentDirectory); @@ -266,6 +270,10 @@ final class FileListComp extends AnchorPane { private void borderScroll(TableView tableView, DragEvent event) { TableViewSkin skin = (TableViewSkin) tableView.getSkin(); + if (skin == null) { + return; + } + VirtualFlow flow = (VirtualFlow) skin.getChildren().get(1); ScrollBar vbar = (ScrollBar) flow.getChildrenUnmodifiable().get(2);