Skip to content

Commit

Permalink
Fix crash when generating thumbnail during scan
Browse files Browse the repository at this point in the history
  • Loading branch information
WithoutPants committed Feb 23, 2024
1 parent f2bc3d5 commit a302fc7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/manager/task_scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,15 @@ func (g *imageGenerators) Generate(ctx context.Context, i *models.Image, f model
t := g.input
path := f.Base().Path

// this is a bit of a hack: the task requires files to be loaded, but
// we don't really need to since we already have the file
ii := *i
ii.Files = models.NewRelatedFiles([]models.File{f})

if t.ScanGenerateThumbnails {
// this should be quick, so always generate sequentially
taskThumbnail := GenerateImageThumbnailTask{
Image: *i,
Image: ii,
Overwrite: overwrite,
}

Expand All @@ -422,11 +427,6 @@ func (g *imageGenerators) Generate(ctx context.Context, i *models.Image, f model
// avoid adding a task if the file isn't a video file
_, isVideo := f.(*models.VideoFile)
if isVideo && t.ScanGenerateClipPreviews {
// this is a bit of a hack: the task requires files to be loaded, but
// we don't really need to since we already have the file
ii := *i
ii.Files = models.NewRelatedFiles([]models.File{f})

progress.AddTotal(1)
previewsFn := func(ctx context.Context) {
taskPreview := GenerateClipPreviewTask{
Expand Down

0 comments on commit a302fc7

Please sign in to comment.