fixed crash on empty metadata

This commit is contained in:
2026-04-17 11:53:51 +02:00
parent fa0e2a5103
commit 49c32e3f8f

View File

@@ -10,6 +10,8 @@ import (
)
func readVorbisMetadata(file string) (*Metadata, error) {
slog.Debug("Reading VORBIS metadata", "file", file)
f, err := os.Open(file)
if err != nil {
return nil, err
@@ -27,6 +29,11 @@ func readVorbisMetadata(file string) (*Metadata, error) {
return nil, err
}
if cmt == nil {
slog.Debug("Metadata empty", "file", file)
return &Metadata{}, nil
}
titles, err := cmt.Get(flacvorbis.FIELD_TITLE)
if err != nil {
return nil, err