Skip to content

Commit

Permalink
set revision to 0 if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
simerplaha committed Sep 8, 2020
1 parent c199129 commit 3bf7049
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions macros/src/main/scala/swaydb/macros/VersionReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,18 @@ object VersionReader {
}

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

val (major, minor, revision) =
regex.findFirstMatchIn(versionString) match {
case Some(value) =>
val major = value.group(1)
val minor = value.group(2)
val revision = value.group(3)
(major.toInt, minor.toInt, revision.toInt)
if (revision == null)
(major.toInt, minor.toInt, 0)
else
(major.toInt, minor.toInt, revision.toInt)

case None =>
c.abort(
Expand Down

0 comments on commit 3bf7049

Please sign in to comment.