PluginManager: account for possible invalid format of API version

we're seeing a lot of crashes because of this.
This commit is contained in:
Dylan K. Taylor
2021-10-05 18:36:00 +01:00
parent 0ad663ff50
commit 7d06b76aaf
5 changed files with 23 additions and 1 deletions

View File

@@ -63,6 +63,10 @@ class VersionString{
$this->suffix = $matches[4] ?? "";
}
public static function isValidBaseVersion(string $baseVersion) : bool{
return preg_match('/^\d+\.\d+\.\d+(?:-(.*))?$/', $baseVersion, $matches) === 1;
}
public function getNumber() : int{
return (($this->major << 9) | ($this->minor << 5) | $this->patch);
}