mpv-packaging icon indicating copy to clipboard operation
mpv-packaging copied to clipboard

updater.ps1 "Cannot index into a null array" error when no match in function ExtractGitFromFile

Open nuriho opened this issue 2 years ago • 0 comments

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

nuriho avatar Nov 24 '23 14:11 nuriho