Skip to content

Commit 4f8b432

Browse files
committed
use fallback version string "unknown" if no version string is found in resources (e.g. when not running from .jar file but from .class files in IDE)
1 parent dd7d59d commit 4f8b432

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Scalatron/src/scalatron/Version.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@ package scalatron
55

66
object Version
77
{
8-
val VersionString = Version.getClass.getPackage.getImplementationVersion
8+
val VersionString = {
9+
// if we are not running from a .jar file (e.g. in debugger from .class files), the resource query may return 'null'
10+
val versionFromResource = Version.getClass.getPackage.getImplementationVersion
11+
if(versionFromResource == null) "unknown" else versionFromResource
12+
}
913
}

0 commit comments

Comments
 (0)