fix(requests): ignore nil presence backfill repo
This commit is contained in:
@@ -40,7 +40,7 @@ type CatalogPresence struct {
|
||||
|
||||
func NewCatalogPresence(items *catalog.ItemRepository, providerIDs ...*catalog.ProviderIDRepository) *CatalogPresence {
|
||||
var backfill tmdbBackfiller
|
||||
if len(providerIDs) > 0 {
|
||||
if len(providerIDs) > 0 && providerIDs[0] != nil {
|
||||
backfill = providerIDs[0]
|
||||
}
|
||||
return &CatalogPresence{items: items, tmdbBackfill: backfill}
|
||||
|
||||
@@ -82,3 +82,10 @@ func TestCatalogPresenceKeepsLookupTMDBCompatibility(t *testing.T) {
|
||||
t.Fatalf("lookup candidates = %+v, want tmdb candidate", lookup.got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewCatalogPresenceIgnoresNilBackfiller(t *testing.T) {
|
||||
presence := NewCatalogPresence(nil, nil)
|
||||
if presence.tmdbBackfill != nil {
|
||||
t.Fatalf("tmdbBackfill = %#v, want nil", presence.tmdbBackfill)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user