Skip to content

Commit

Permalink
Add error check for when regex match fails
Browse files Browse the repository at this point in the history
  • Loading branch information
jvlflame committed Jul 12, 2020
1 parent b1646a0 commit be2a752
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Javinizer/Private/Convert-JavTitle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ function Convert-JavTitle {
$regexPtMatch = $Settings.General.'regex-pt-match'
$index = 0
foreach ($file in $fileBaseNameUpper) {
$id = ($file | Select-String $regex).Matches.Groups[$regexIdMatch].Value
$partNum = ($file | Select-String $regex).Matches.Groups[$regexPtMatch].Value
try {
$id = ($file | Select-String $regex).Matches.Groups[$regexIdMatch].Value
$partNum = ($file | Select-String $regex).Matches.Groups[$regexPtMatch].Value
} catch {
Write-Debug "[$(Get-TimeStamp)][$($MyInvocation.MyCommand.Name)] File [$file] not matched by regex"
break
}
if ($fileBaseNameUpper -eq 1) {
if ($partNum -ne '') {
$fileBaseNameUpper = "$id-pt$PartNum"
Expand Down

0 comments on commit be2a752

Please sign in to comment.