Backend: Fix nil pointer panic in RelatedFiles() #454

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-08-12 03:36:49 +02:00
parent d53084b095
commit e0eaa72843

View file

@ -313,12 +313,14 @@ func (m *MediaFile) RelatedFiles(stripSequence bool) (result RelatedFiles, err e
result.Main = f
} else if f.IsHEIF() {
result.Main = f
} else if f.IsJpeg() && len(result.Main.FileName()) > len(f.FileName()) {
result.Main = f
} else if f.IsImageOther() {
result.Main = f
} else if f.IsVideo() {
result.Main = f
} else if result.Main != nil && f.IsJpeg() {
if result.Main.IsJpeg() && len(result.Main.FileName()) > len(f.FileName()) {
result.Main = f
}
}
result.Files = append(result.Files, f)