Skip to content

Commit 3bf7049

Browse files
committed
set revision to 0 if empty
1 parent c199129 commit 3bf7049

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

macros/src/main/scala/swaydb/macros/VersionReader.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,18 @@ object VersionReader {
8383
}
8484

8585
//get major.minor.revision from version.
86-
val regex = """(\d+)\.(\d+)\.(\d+)""".r
86+
val regex = """(\d+)\.(\d+)\.?(\d+)?""".r
8787

8888
val (major, minor, revision) =
8989
regex.findFirstMatchIn(versionString) match {
9090
case Some(value) =>
9191
val major = value.group(1)
9292
val minor = value.group(2)
9393
val revision = value.group(3)
94-
(major.toInt, minor.toInt, revision.toInt)
94+
if (revision == null)
95+
(major.toInt, minor.toInt, 0)
96+
else
97+
(major.toInt, minor.toInt, revision.toInt)
9598

9699
case None =>
97100
c.abort(

0 commit comments

Comments
 (0)