Skip to content

Commit 44f670d

Browse files
authored
fix: NullPointerException in KCLUtil's getMatchedModule method (#52)
add null check in KCLUtil's getMatchedModule method
1 parent 5f6d2d3 commit 44f670d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/io/kusionstack/kcl/KCLUtil.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ public static boolean containsKclFile(PsiDirectory dir, boolean recursive) {
113113
return null;
114114
}
115115

116-
private static PsiFileSystemItem getMatchedModule(PsiDirectory current, String name) {
116+
private static @Nullable PsiFileSystemItem getMatchedModule(@Nullable PsiDirectory current, String name) {
117+
if (current == null) {
118+
// Early return if current is null
119+
return null;
120+
}
117121
// 优先检查子目录
118122
PsiDirectory dir = current.findSubdirectory(name);
119123
if (dir != null) {

0 commit comments

Comments
 (0)