Skip to content

Commit 249b57f

Browse files
adrianwit@gmail.comadrianwit@gmail.com
authored andcommitted
patched nil pointer
1 parent e6d757c commit 249b57f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

s3/storager.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ func getAwsConfig(options []storage.Option) (config *aws.Config, err error) {
7878
if config, err = filterAuthOption(options); err != nil {
7979
return nil, err
8080
}
81+
if config == nil {
82+
config = &aws.Config{}
83+
}
8184
region := &Region{}
8285
if _, ok := option.Assign(options, &region); ok {
8386
config.Region = &region.Name
@@ -105,7 +108,7 @@ func newStorager(ctx context.Context, baseURL string, options ...storage.Option)
105108
}
106109
output, err := result.S3.GetBucketLocation(&s3.GetBucketLocationInput{Bucket: &result.bucket})
107110
if err == nil {
108-
if output.LocationConstraint != nil && result.config != nil {
111+
if output.LocationConstraint != nil {
109112
result.config.Region = output.LocationConstraint
110113
result.S3 = s3.New(session.New(), result.config)
111114
}

0 commit comments

Comments
 (0)