mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
fix(indexers): don't crash on empty custom-definition (#311)
This commit is contained in:
parent
62392fd14c
commit
0256ea52fd
1 changed files with 7 additions and 4 deletions
|
@ -424,8 +424,6 @@ func (s *service) LoadCustomIndexerDefinitions() error {
|
|||
|
||||
s.log.Trace().Msgf("parsing custom: %v", file)
|
||||
|
||||
var d *domain.IndexerDefinition
|
||||
|
||||
//data, err := fs.ReadFile(Definitions, filePath)
|
||||
data, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
|
@ -433,12 +431,17 @@ func (s *service) LoadCustomIndexerDefinitions() error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = yaml.Unmarshal(data, &d)
|
||||
if err != nil {
|
||||
var d *domain.IndexerDefinition
|
||||
if err = yaml.Unmarshal(data, &d); err != nil {
|
||||
s.log.Error().Stack().Err(err).Msgf("failed unmarshal file: %v", file)
|
||||
return err
|
||||
}
|
||||
|
||||
if d == nil {
|
||||
s.log.Warn().Stack().Err(err).Msgf("skipping empty file: %v", file)
|
||||
continue
|
||||
}
|
||||
|
||||
if d.Implementation == "" {
|
||||
d.Implementation = "irc"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue