Skip to content

Commit 1fe63fe

Browse files
committed
fix: fix null issue #19 #14
1 parent 7ab469b commit 1fe63fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

java/src/main/kotlin/cc/unitmesh/idea/spring/JavaSpringCodeCreator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class JavaSpringCodeCreator(val project: Project) : SpringBaseCrud {
7272
val allControllerFiles = getAllControllerFiles()
7373
if (allControllerFiles.isEmpty()) return
7474

75-
val targetControllerFile = allControllerFiles.first { it.name == "$targetController.java" }
75+
val targetControllerFile = allControllerFiles.firstOrNull { it.name == "$targetController.java" } ?: return
7676

7777
updateCodeMethod(targetControllerFile, targetController, code, project, psiElementFactory)
7878
}

0 commit comments

Comments
 (0)