Skip to content

Commit 6f3aa42

Browse files
committed
fix: provider panicked when trying to access nil source location field
1 parent f14db80 commit 6f3aa42

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

awsmt/helpers_source_location.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package awsmt
33
import (
44
"context"
55
"fmt"
6+
"terraform-provider-mediatailor/awsmt/models"
7+
68
"github.com/aws/aws-sdk-go-v2/service/mediatailor"
79
awsTypes "github.com/aws/aws-sdk-go-v2/service/mediatailor/types"
810
"github.com/hashicorp/terraform-plugin-framework/types"
9-
"terraform-provider-mediatailor/awsmt/models"
1011
)
1112

1213
func getCreateSourceLocationInput(model models.SourceLocationModel) mediatailor.CreateSourceLocationInput {
@@ -122,7 +123,9 @@ func getUpdateSourceLocationInput(model models.SourceLocationModel) mediatailor.
122123

123124
params.AccessConfiguration = getAccessConfigurationInput(model.AccessConfiguration)
124125
// Default Segment Delivery Configuration
125-
params.DefaultSegmentDeliveryConfiguration = getDefaultSegmentDeliveryConfigurationInput(model.DefaultSegmentDeliveryConfiguration)
126+
if model.DefaultSegmentDeliveryConfiguration != nil {
127+
params.DefaultSegmentDeliveryConfiguration = getDefaultSegmentDeliveryConfigurationInput(model.DefaultSegmentDeliveryConfiguration)
128+
}
126129
// HTTP Configuration
127130
params.HttpConfiguration = getHttpConfigurationInput(model.HttpConfiguration)
128131

0 commit comments

Comments
 (0)