File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,6 +125,11 @@ class Tvdb extends ExternalAPI implements TvShowIndexer {
125125 try {
126126 const tvdbData = await this . fetchTvdbShowData ( tvdbId ) ;
127127 const seasons = this . processSeasons ( tvdbData ) ;
128+
129+ if ( ! seasons . length ) {
130+ return tmdbTvShow ;
131+ }
132+
128133 return { ...tmdbTvShow , seasons } ;
129134 } catch ( error ) {
130135 logger . error (
@@ -143,6 +148,10 @@ class Tvdb extends ExternalAPI implements TvShowIndexer {
143148 }
144149
145150 private processSeasons ( tvdbData : TvdbTvShowDetail ) : TmdbTvSeasonResult [ ] {
151+ if ( ! tvdbData || ! tvdbData . seasons ) {
152+ return [ ] ;
153+ }
154+
146155 return tvdbData . seasons
147156 . filter ( ( season ) => season . seasonNumber !== 0 )
148157 . map ( ( season ) => this . createSeasonData ( season , tvdbData ) ) ;
@@ -204,6 +213,10 @@ class Tvdb extends ExternalAPI implements TvShowIndexer {
204213 seasonNumber : number ,
205214 tvId : number
206215 ) : TmdbTvEpisodeResult [ ] {
216+ if ( ! tvdbSeason || ! tvdbSeason . episodes ) {
217+ return [ ] ;
218+ }
219+
207220 return tvdbSeason . episodes
208221 . filter ( ( episode ) => episode . seasonNumber === seasonNumber )
209222 . map ( ( episode , index ) => this . createEpisodeData ( episode , index , tvId ) ) ;
You can’t perform that action at this time.
0 commit comments