File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
src/main/kotlin/org/domaframework/doma/intellij/common Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ fun getExtension(type: String): String =
3737 * Does it match the Dao file type condition?
3838 */
3939fun isJavaOrKotlinFileType (daoFile : PsiFile ): Boolean {
40+ if (daoFile.virtualFile == null ) return false
4041 val fileType = FileTypeManager .getInstance().getFileTypeByFile(daoFile.virtualFile)
4142 return when (fileType.name) {
4243 " JAVA" , " Kotlin" -> true
@@ -57,7 +58,7 @@ fun isSupportFileType(file: PsiFile): Boolean {
5758
5859fun isInjectionSqlFile (file : PsiFile ): Boolean {
5960 val extension = file.fileType.defaultExtension
60- val filePath = file.virtualFile.path
61+ val filePath = file.virtualFile? .path ? : return false
6162 return when (extension) {
6263 " sql" -> true
6364 else -> false
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ fun formatDaoPathFromSqlFilePath(
110110 if (isInjectionSqlFile(relativeBaseSqlFile)) {
111111 return " "
112112 }
113- val sqlPath = relativeBaseSqlFile.virtualFile.path
113+ val sqlPath = relativeBaseSqlFile.virtualFile? .path ? : return " "
114114 var relativeFilePath = sqlPath.substring(projectRootPath.length)
115115 if (! relativeFilePath.startsWith(" /" )) {
116116 relativeFilePath = " /$relativeFilePath "
You can’t perform that action at this time.
0 commit comments