Skip to content

Commit

Permalink
Fixed nil pointer for Behaviors (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanprodan-okta authored Jul 23, 2021
1 parent a5f1773 commit 09bad12
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions okta/resource_okta_policy_rule_sign_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,18 @@ func resourcePolicySignOnRuleRead(ctx context.Context, d *schema.ResourceData, m
if rule.Actions.SignOn.FactorPromptMode != "" {
_ = d.Set("mfa_prompt", rule.Actions.SignOn.FactorPromptMode)
}
if rule.Conditions != nil && rule.Conditions.RiskScore != nil {
_ = d.Set("risc_level", rule.Conditions.RiskScore.Level)
}
err = setNonPrimitives(d, map[string]interface{}{
"behaviors": convertStringSetToInterface(rule.Conditions.Risk.Behaviors),
})
if err != nil {
return diag.Errorf("failed to set sign-on policy rule behaviors: %v", err)
if rule.Conditions != nil {
if rule.Conditions.RiskScore != nil {
_ = d.Set("risc_level", rule.Conditions.RiskScore.Level)
}
if rule.Conditions.Risk != nil {
err = setNonPrimitives(d, map[string]interface{}{
"behaviors": convertStringSetToInterface(rule.Conditions.Risk.Behaviors),
})
if err != nil {
return diag.Errorf("failed to set sign-on policy rule behaviors: %v", err)
}
}
}
if rule.Actions.SignOn.Access == "CHALLENGE" {
chain := rule.Actions.SignOn.Challenge.Chain
Expand Down

0 comments on commit 09bad12

Please sign in to comment.