Skip to content

Commit 1e0a14d

Browse files
hyphzanatolystansler
authored andcommitted
fix: NPE on starting up on Windows
Prevents a null exception error when starting up on Windows caused by the pathname beginning with a drive letter.
1 parent b19f6cf commit 1e0a14d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/kotlin/app/utils/FileHelper.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ object FileHelper {
4747
}
4848

4949
fun getJarPath(): Path {
50-
val fullPathString = URLDecoder.decode(FileHelper::class.java
51-
.protectionDomain.codeSource.location.toURI().path, "UTF-8")
52-
val fullPath = Paths.get(fullPathString)
50+
val fullPathURI = FileHelper::class.java.protectionDomain.codeSource.location.toURI()
51+
val fullPath = Paths.get(fullPathURI)
5352
val root = fullPath.root
5453
// Removing jar filename.
5554
return root.resolve(fullPath.subpath(0, fullPath.nameCount - 1))

0 commit comments

Comments
 (0)