Skip to content

Commit

Permalink
fixed: crash if movie/tvshow certification language (limit) is set to…
Browse files Browse the repository at this point in the history
… an unknown value
  • Loading branch information
DanCooper committed Jan 24, 2016
1 parent e9f36d9 commit e89a07f
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions EmberAPI/clsAPINFO.vb
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,19 @@ Public Class NFO
DBMovie.Movie.Certifications.AddRange(scrapedmovie.Certifications)
new_Certification = True
Else
For Each tCert In scrapedmovie.Certifications
If tCert.StartsWith(APIXML.CertLanguagesXML.Language.FirstOrDefault(Function(l) l.abbreviation = Master.eSettings.MovieScraperCertLang).name) Then
DBMovie.Movie.Certifications.Clear()
DBMovie.Movie.Certifications.Add(tCert)
new_Certification = True
Exit For
End If
Next
Dim CertificationLanguage = APIXML.CertLanguagesXML.Language.FirstOrDefault(Function(l) l.abbreviation = Master.eSettings.MovieScraperCertLang)
If CertificationLanguage IsNot Nothing AndAlso CertificationLanguage.name IsNot Nothing AndAlso Not String.IsNullOrEmpty(CertificationLanguage.name) Then
For Each tCert In scrapedmovie.Certifications
If tCert.StartsWith(CertificationLanguage.name) Then
DBMovie.Movie.Certifications.Clear()
DBMovie.Movie.Certifications.Add(tCert)
new_Certification = True
Exit For
End If
Next
Else
logger.Error("Movie Certification Language (Limit) not found. Please check your settings!")
End If
End If
ElseIf Master.eSettings.MovieScraperCleanFields AndAlso Not Master.eSettings.MovieScraperCert AndAlso Not Master.eSettings.MovieLockCert Then
DBMovie.Movie.Certifications.Clear()
Expand Down Expand Up @@ -575,14 +580,19 @@ Public Class NFO
DBTV.TVShow.Certifications.AddRange(scrapedshow.Certifications)
new_Certification = True
Else
For Each tCert In scrapedshow.Certifications
If tCert.StartsWith(APIXML.CertLanguagesXML.Language.FirstOrDefault(Function(l) l.abbreviation = Master.eSettings.TVScraperShowCertLang).name) Then
DBTV.TVShow.Certifications.Clear()
DBTV.TVShow.Certifications.Add(tCert)
new_Certification = True
Exit For
End If
Next
Dim CertificationLanguage = APIXML.CertLanguagesXML.Language.FirstOrDefault(Function(l) l.abbreviation = Master.eSettings.TVScraperShowCertLang)
If CertificationLanguage IsNot Nothing AndAlso CertificationLanguage.name IsNot Nothing AndAlso Not String.IsNullOrEmpty(CertificationLanguage.name) Then
For Each tCert In scrapedshow.Certifications
If tCert.StartsWith(CertificationLanguage.name) Then
DBTV.TVShow.Certifications.Clear()
DBTV.TVShow.Certifications.Add(tCert)
new_Certification = True
Exit For
End If
Next
Else
logger.Error("TV Show Certification Language (Limit) not found. Please check your settings!")
End If
End If
ElseIf Master.eSettings.TVScraperCleanFields AndAlso Not Master.eSettings.TVScraperShowCert AndAlso Not Master.eSettings.TVLockShowCert Then
DBTV.TVShow.Certifications.Clear()
Expand Down

0 comments on commit e89a07f

Please sign in to comment.