Skip to content

Commit

Permalink
fix potential nil pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
meyerjrr committed Sep 18, 2024
1 parent 2b9dde1 commit 328a6b6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/hook/accessrequesthook/accessrequesthook.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,17 @@ func (h Hook) NoEntitlementAccess(ctx context.Context, cfg *config.Context, inpu

if input.Duration != nil {
req.Entitlements[i].Duration = input.Duration
continue
}

} else if result.DurationConfiguration.DefaultDuration != nil {
req.Entitlements[i].Duration = result.DurationConfiguration.DefaultDuration
} else {
req.Entitlements[i].Duration = result.DurationConfiguration.MaxDuration
if result.DurationConfiguration != nil {
if result.DurationConfiguration.DefaultDuration != nil {
req.Entitlements[i].Duration = result.DurationConfiguration.DefaultDuration
} else {
req.Entitlements[i].Duration = result.DurationConfiguration.MaxDuration
}
}

}

// the spinner must be started after prompting for reason, otherwise the prompt gets hidden
Expand Down

0 comments on commit 328a6b6

Please sign in to comment.