Skip to content

Commit

Permalink
Fix libpcre2 version detection not working for -RC{N} versions (#14478)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frityet committed Apr 16, 2024
1 parent 246cd7c commit 3ba6acc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/regex/pcre2.cr
Expand Up @@ -17,7 +17,8 @@ module Regex::PCRE2
version = self.version
dot = version.index('.') || raise RuntimeError.new("Invalid libpcre2 version")
space = version.index(' ', dot) || raise RuntimeError.new("Invalid libpcre2 version")
{version.byte_slice(0, dot).to_i, version.byte_slice(dot + 1, space - dot - 1).to_i}
# PCRE2 versions can contain -RC{N} which would make `.to_i` fail unless strict is set to false
{version.byte_slice(0, dot).to_i, version.byte_slice(dot + 1, space - dot - 1).to_i(strict: false)}
end

# :nodoc:
Expand Down

0 comments on commit 3ba6acc

Please sign in to comment.