Skip to content

Commit 00e4d0f

Browse files
authored
Fix crash when project name has no colon (#43)
1 parent b5df97a commit 00e4d0f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • plugin-build/modulegraph/src/main/kotlin/dev/iurysouza/modulegraph/graph
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package dev.iurysouza.modulegraph.graph
22

3-
internal fun String.getProjectName(showFullPath: Boolean): String {
4-
return if (showFullPath) {
3+
internal fun String.getProjectName(
4+
showFullPath: Boolean,
5+
): String = runCatching {
6+
if (showFullPath) {
57
this
68
} else {
79
this.split(":").last { it.isNotBlank() }
810
}
9-
}
11+
}.getOrElse { this }
12+
1013
internal fun StringBuilder.lineBreak() {
1114
append("\n")
1215
}

0 commit comments

Comments
 (0)