mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
Fix crash when generating thumbnail during scan
This commit is contained in:
parent
f2bc3d5567
commit
a302fc78ea
1 changed files with 6 additions and 6 deletions
|
|
@ -409,10 +409,15 @@ func (g *imageGenerators) Generate(ctx context.Context, i *models.Image, f model
|
||||||
t := g.input
|
t := g.input
|
||||||
path := f.Base().Path
|
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 {
|
if t.ScanGenerateThumbnails {
|
||||||
// this should be quick, so always generate sequentially
|
// this should be quick, so always generate sequentially
|
||||||
taskThumbnail := GenerateImageThumbnailTask{
|
taskThumbnail := GenerateImageThumbnailTask{
|
||||||
Image: *i,
|
Image: ii,
|
||||||
Overwrite: overwrite,
|
Overwrite: overwrite,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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
|
// avoid adding a task if the file isn't a video file
|
||||||
_, isVideo := f.(*models.VideoFile)
|
_, isVideo := f.(*models.VideoFile)
|
||||||
if isVideo && t.ScanGenerateClipPreviews {
|
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)
|
progress.AddTotal(1)
|
||||||
previewsFn := func(ctx context.Context) {
|
previewsFn := func(ctx context.Context) {
|
||||||
taskPreview := GenerateClipPreviewTask{
|
taskPreview := GenerateClipPreviewTask{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue