Skip to content

Commit b58e026

Browse files
authored
fix: cdn - read nil pointer exception of maplist (#1163)
1 parent db71178 commit b58e026

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tencentcloud/resource_tc_cdn_domain.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ func resourceTencentCloudCdnDomainCreate(d *schema.ResourceData, meta interface{
10741074
}
10751075
if v, ok := config["force_redirect"]; ok {
10761076
forceRedirect := v.([]interface{})
1077-
if len(forceRedirect) > 0 {
1077+
if len(forceRedirect) > 0 && forceRedirect[0] != nil {
10781078
var redirect cdn.ForceRedirect
10791079
redirectMap := forceRedirect[0].(map[string]interface{})
10801080
if sw := redirectMap["switch"]; sw.(string) != "" {
@@ -1257,23 +1257,23 @@ func resourceTencentCloudCdnDomainRead(d *schema.ResourceData, meta interface{})
12571257
oldHttpsConfigs = d.Get("https_config").([]interface{})
12581258
}
12591259
oldHttpsConfig := make(map[string]interface{})
1260-
if len(oldHttpsConfigs) > 0 {
1260+
if len(oldHttpsConfigs) > 0 && oldHttpsConfigs[0] != nil {
12611261
oldHttpsConfig = oldHttpsConfigs[0].(map[string]interface{})
12621262
}
12631263
oldServerConfigs := make([]interface{}, 0)
12641264
if _, ok := oldHttpsConfig["server_certificate_config"]; ok {
12651265
oldServerConfigs = oldHttpsConfig["server_certificate_config"].([]interface{})
12661266
}
12671267
oldServerConfig := make(map[string]interface{})
1268-
if len(oldServerConfigs) > 0 {
1268+
if len(oldServerConfigs) > 0 && oldServerConfigs[0] != nil {
12691269
oldServerConfig = oldServerConfigs[0].(map[string]interface{})
12701270
}
12711271
oldClientConfigs := make([]interface{}, 0)
12721272
if _, ok := oldHttpsConfig["client_certificate_config"]; ok {
12731273
oldClientConfigs = oldHttpsConfig["client_certificate_config"].([]interface{})
12741274
}
12751275
oldClientConfig := make(map[string]interface{})
1276-
if len(oldClientConfigs) > 0 {
1276+
if len(oldClientConfigs) > 0 && oldClientConfigs[0] != nil {
12771277
oldClientConfig = oldClientConfigs[0].(map[string]interface{})
12781278
}
12791279

@@ -1581,7 +1581,7 @@ func resourceTencentCloudCdnDomainUpdate(d *schema.ResourceData, meta interface{
15811581
}
15821582
if v, ok := config["force_redirect"]; ok {
15831583
forceRedirect := v.([]interface{})
1584-
if len(forceRedirect) > 0 {
1584+
if len(forceRedirect) > 0 && forceRedirect[0] != nil {
15851585
var redirect cdn.ForceRedirect
15861586
redirectMap := forceRedirect[0].(map[string]interface{})
15871587
if sw := redirectMap["switch"]; sw.(string) != "" {

0 commit comments

Comments
 (0)