mpv-packaging
mpv-packaging copied to clipboard
updater.ps1 "Cannot index into a null array" error when no match in function ExtractGitFromFile
In
function ExtractGitFromFile {
$stripped = .\mpv --no-config | select-string "mpv" | select-object -First 1
$pattern = "-g([a-z0-9-]{7})"
$bool = $stripped -match $pattern
return $matches[1]
}
if there is no match, script will terminate with error "Cannot index into a null array"
suggest using a check like:
if($bool) { return $matches[1] } else { return "" }
Probably will get same error from ExtractGitFromURL and ExtractDateFromURL