From 96e26faf3f3e3d83ed63e063652930a1da2a0d9f Mon Sep 17 00:00:00 2001 From: yurii-yu Date: Wed, 15 Jan 2025 10:36:57 +0100 Subject: [PATCH] #853: avoid the NullPointerException by providing a default one --- .../java/com/devonfw/tools/ide/property/PathProperty.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cli/src/main/java/com/devonfw/tools/ide/property/PathProperty.java b/cli/src/main/java/com/devonfw/tools/ide/property/PathProperty.java index f87c4e2d3..7e8a0d8f4 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/property/PathProperty.java +++ b/cli/src/main/java/com/devonfw/tools/ide/property/PathProperty.java @@ -109,6 +109,10 @@ protected void completeValue(String arg, IdeContext context, Commandlet commandl Path path = Path.of(arg); Path parent = path.getParent(); + //set a default parent directory when unable to obtain the parent directory + if (parent == null) { + parent = Path.of("."); + } String filename = path.getFileName().toString(); if (Files.isDirectory(parent)) { try (Stream children = Files.list(parent)) {