Skip to content

Commit

Permalink
Fix scene merge nil dereference (stashapp#4119)
Browse files Browse the repository at this point in the history
  • Loading branch information
DingDongSoLong4 authored Sep 17, 2023
1 parent 0b7dcbe commit 62173a9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions internal/api/resolver_mutation_scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ func (r *mutationResolver) SceneMerge(ctx context.Context, input SceneMergeInput
}

var values *models.ScenePartial
var coverImageData []byte

if input.Values != nil {
translator := changesetTranslator{
inputMap: getNamedUpdateInputMap(ctx, "input.values"),
Expand All @@ -545,20 +547,19 @@ func (r *mutationResolver) SceneMerge(ctx context.Context, input SceneMergeInput
if err != nil {
return nil, err
}

if input.Values.CoverImage != nil {
var err error
coverImageData, err = utils.ProcessImageInput(ctx, *input.Values.CoverImage)
if err != nil {
return nil, fmt.Errorf("processing cover image: %w", err)
}
}
} else {
v := models.NewScenePartial()
values = &v
}

var coverImageData []byte
if input.Values.CoverImage != nil {
var err error
coverImageData, err = utils.ProcessImageInput(ctx, *input.Values.CoverImage)
if err != nil {
return nil, fmt.Errorf("processing cover image: %w", err)
}
}

var ret *models.Scene
if err := r.withTxn(ctx, func(ctx context.Context) error {
if err := r.Resolver.sceneService.Merge(ctx, srcIDs, destID, *values); err != nil {
Expand Down

0 comments on commit 62173a9

Please sign in to comment.